package com.api.cube.util;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import javax.servlet.http.HttpServletRequest;




import com.api.browser.bean.SearchConditionOption;
import com.engine.cube.biz.ShardingActionHelper;
import com.engine.cube.util.AddSeclevelUtil;
import com.engine.cube.util.PageExpandUtil;
import com.engine.fnaMulDimensions.util.AccountInfoComInfo;
import com.engine.hrm.biz.HrmClassifiedProtectionBiz;
import com.engine.hrm.biz.HrmCountryCityBiz;
import org.apache.commons.lang3.StringUtils;
import com.engine.common.biz.EncryptConfigBiz;
import com.api.browser.bean.Operate;
import com.api.browser.service.BrowserValueInfoService;
import com.api.browser.util.BrowserConfigComInfo;
import com.api.cube.service.CubeSearchService;
import com.api.doc.detail.util.DocDownloadCheckUtil;
import com.api.formmode.cache.CustomSearchComInfo;
import com.api.formmode.cache.ModeComInfo;
import com.api.formmode.cache.ModeFormComInfo;
import com.api.formmode.util.FormmodeUtil;
import com.cloudstore.dev.api.util.TextUtil;
import com.engine.cube.biz.CardFormHelper;
import com.engine.cube.cmd.app.SaveTabSet;
import com.engine.cube.cmd.list.TransMethodConfigAdd;
import com.engine.cube.cmd.mode.TabTransMethod;
import com.engine.hrm.biz.OrganizationShowSetBiz;
import com.weaver.formmodel.util.DateHelper;
import com.weaver.formmodel.util.StringHelper;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import weaver.archives.ArchivesUtil;
import weaver.conn.RecordSet;
import weaver.cpt.capital.CapitalComInfo;
import weaver.cpt.maintenance.CapitalAssortmentComInfo;
import weaver.crm.Maint.CustomerInfoComInfo;
import weaver.dateformat.DateTransformer;
import weaver.docs.docs.DocComInfo;
import weaver.docs.docs.DocImageManager;
import weaver.docs.senddoc.DocReceiveUnitComInfo;
import weaver.filter.XssUtil;
import weaver.fna.maintenance.BudgetfeeTypeComInfo;
import weaver.fna.maintenance.FnaSystemSetComInfo;
import weaver.formmode.FormModeConfig;
import weaver.formmode.browser.FormModeBrowserUtil;
import weaver.formmode.field.ButtonElement;
import weaver.formmode.interfaces.PopedomCommonAction;
import weaver.formmode.log.FormmodeLog;
import weaver.formmode.search.FormModeTransMethod;
import weaver.formmode.service.CommonConstant;
import weaver.formmode.service.CustomSearchService;
import weaver.formmode.setup.ExpandBaseRightInfo;
import weaver.formmode.setup.ModeRightInfo;
import weaver.formmode.tree.CustomTreeUtil;
import weaver.formmode.view.ModeShareManager;
import weaver.formmode.virtualform.VirtualFormHandler;
import weaver.general.BaseBean;
import weaver.general.StaticObj;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.hrm.UserManager;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.interfaces.workflow.browser.Browser;
import weaver.interfaces.workflow.browser.BrowserBean;
import weaver.proj.Maint.ProjectInfoComInfo;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.field.BrowserComInfo;
import weaver.workflow.request.ResourceConditionManager;
import weaver.workflow.workflow.WorkflowBillComInfo;
import weaver.workflow.workflow.WorkflowRequestComInfo;

/*
 * Created on 2006-05-18
 * Copyright (c) 2001-2006 泛微软件
 * 泛微协同商务系统，版权所有。
 *
 */
/**
 * 流程列表页数据库值和显示名的转化
 * @author xwj
 * @version10.
 */
public enum CubeSearchTransMethod {
    INSTANCE;

    private FormmodeLog formmodeLog = new FormmodeLog();
    private ResourceComInfo rc = null;
    private CustomerInfoComInfo cci = null;
    private DepartmentComInfo DepartmentComInfo1 = null;
    private SubCompanyComInfo SubCompanyComInfo1 = null;
    OrganizationShowSetBiz orgShowBiz = null;
    private ProjectInfoComInfo ProjectInfoComInfo1 = null;
    private DocComInfo DocComInfo1 = null;
    private weaver.workflow.field.BrowserComInfo BrowserComInfo = null;
    private weaver.docs.docs.DocImageManager DocImageManager = null;
    private WorkflowRequestComInfo WorkflowRequestComInfo1 = null;
    private PopedomCommonAction object = null;
    private CapitalComInfo CapitalComInfo1 = null;
    private CapitalAssortmentComInfo CapitalAssortmentComInfo =null;
    private ResourceConditionManager rcm = null;
    private DocReceiveUnitComInfo duc = null;
    private CustomSearchComInfo customSearchComInfo = null;
    private WorkflowBillComInfo workflowBillComInfo = null;
    private ModeFormComInfo modeFormComInfo = null;
    private TabTransMethod tabTransMethod = null;
    private ModeComInfo modeComInfo = null;
    public int count = 0;
    private String isTemplate;
    public static HashMap<String ,HashMap<String,HashMap<String,Object>>> cache = new HashMap<String ,HashMap<String,HashMap<String,Object>>>();
    public static FormModeConfig formModeConfig = new FormModeConfig();
    public XssUtil xssUtil = null;
    private static final ConcurrentHashMap<String, Map<String, Object>> optRightMap = new ConcurrentHashMap<String, Map<String,Object>>();
    private static final int intervaltime=120;
    public String getIsTemplate() {
        return isTemplate;
    }

    public void setIsTemplate(String isTemplate) {
        this.isTemplate = isTemplate;
    }

    /**
     * 是否直接返回密文数据
     */
    private boolean isAutoDecrypt = false;
    public void isAutoDecrypt(boolean isAutoDecrypt){
        this.isAutoDecrypt = isAutoDecrypt;
    }
    
    private CubeSearchTransMethod() {
        try {
            cci = new CustomerInfoComInfo();
            rc = new ResourceComInfo();
            DocComInfo1 = new DocComInfo();
            ProjectInfoComInfo1 = new ProjectInfoComInfo();
            BrowserComInfo = new BrowserComInfo();
            DepartmentComInfo1 = new DepartmentComInfo();
            SubCompanyComInfo1 = new SubCompanyComInfo();
            DocImageManager = new DocImageManager();
            WorkflowRequestComInfo1 = new WorkflowRequestComInfo();
            object = null;
            CapitalComInfo1 = new CapitalComInfo();
            CapitalAssortmentComInfo = new CapitalAssortmentComInfo();
            rcm = new ResourceConditionManager();
            duc = new DocReceiveUnitComInfo();
            xssUtil = new XssUtil();
            customSearchComInfo = new CustomSearchComInfo();
            workflowBillComInfo = new WorkflowBillComInfo();
            modeComInfo = new ModeComInfo();
            modeFormComInfo = new ModeFormComInfo();
            tabTransMethod=new TabTransMethod();
        } catch (Exception ex) {
            this.formmodeLog.writeLog(ex);
        }
    }

    /**
     * 是否显示checkbox
     * @param para 参数字符串
     * @return true/false
     */
    public String getModeMonitorCheckBox(String para){
        RecordSet rs = new RecordSet();
        String paras[] = Util.TokenizerString2(para, "+");
        int id = Util.getIntValue(paras[0]);
        int userid = Util.getIntValue(paras[1]);
        int logintype= Util.getIntValue(paras[2],1);
        int modeid = Util.getIntValue(paras[3]);
        //viewtype
        //0、查看
        //1、新建
        //2、编辑
        //3、监控
        int viewtype = Util.getIntValue(paras[4],0);
        String flag="false";
        User user = new User();

        try{
            ResourceComInfo rci = new ResourceComInfo();
            user.setUid(userid);
            user.setLogintype(String.valueOf(logintype));
            user.setSeclevel(rci.getSeclevel(String.valueOf(userid)));
            user.setUserDepartment(Util.getIntValue(rci.getDepartmentID(String.valueOf(userid))));
            user.setUserSubCompany1(Util.getIntValue(rci.getSubCompanyID(String.valueOf(userid))));
            user.setType(0);//oa用户
        }catch(Exception e){
            this.formmodeLog.writeLog(e);
        }
        if(viewtype==3){
            flag = "true";
        }else{
            if(logintype==1){
                ModeShareManager ModeShareManager = new ModeShareManager();
                ModeShareManager.setModeId(modeid);
                String rightStr = ModeShareManager.getShareDetailTableByUser("formmode",user);
                rs.executeSql("select * from "+rightStr+" t where sourceid="+id);
                if(rs.next()){
                    int MaxShare = rs.getInt("sharelevel");
                    if(MaxShare > 1) {
                        if(MaxShare == 3) {
                            flag = "true";		//有完全控制权限的出现删除按钮
                        }
                    }
                }
            }
        }

        return flag;
    }

    /**
     * 把流程创建人由ID转为显示中文名
     *
     * @param id
     *            创建人ID
     * @param type
     *            内部/外部
     * @return 显示中文名
     */
    public String getSearchResultName(String id, String type) {
        String returnStr = "";
        if ("1".equals(type)) { // 外部
            returnStr = "<a href=javaScript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/CRM/data/ViewCustomer.jsp?CustomerID="
                    + id + "\")>" + cci.getCustomerInfoname(id) + "</a>";
        } else { // 内部
            returnStr = "<a href=javaScript:openhrm(" + id
                    + ") onclick=\"pointerXY(event)\">"
                    + rc.getResourcename(id) + "</a>";
        }
        return returnStr;
    }

    /**
     * 格式化显示创建时间
     *
     * @param day
     *            日期
     * @param time
     *            时间
     * @return 日期+ " " + 时间
     */
    public String getSearchResultCreateTime(String day, String paraTwo) {
        String[] tempStr = Util.TokenizerString2(paraTwo, "+");
        String time = "";
        int customid = 0;
        String showmethod = "";
        if(tempStr.length>2){
            time = tempStr[0];
            customid = Util.getIntValue(tempStr[1],0);
            showmethod = Util.null2String(tempStr[2]);
        }else{
            time = paraTwo;
        }
        if("1".equals(showmethod)){
            return changeShowmethod(customid,"-1",day,time,paraTwo);
        }else{
            return day+" "+time;
        }

    }

    /**
     * 查询列表操作按钮判断
     */
    public List<String> getSearchResultOperation(String requestid){
        List<String> result = new ArrayList<String>();
        return result;
    }

    /**
     * 查询列表操作按钮判断
     */
    public List<String> getSearchResultOperation(String sourceid, String para){
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        UserManager userManager = new UserManager();
        List<String> result = new ArrayList<String>();
        result.add("true");//默认放一个
        String[] paras = Util.splitString(para, "+");
        if (paras.length == 0) return result;
        String customid = StringHelper.null2String(paras[0]);
        String uid = StringHelper.null2String(paras[1]);
        String modeid = StringHelper.null2String(paras[2]);
        String formid = Util.null2String(paras[3]);
        int userid = Util.getIntValue(uid, 0);
        int modeidInt = Util.getIntValue(modeid, 0);
        User user = userManager.getUserByUserIdAndLoginType(userid, "1");
        String datashowtype=new CustomSearchComInfo().getDatashowtype(customid);
        //只查询展示在右侧三个...里面的自定义按钮
        RecordSet.executeSql("select buttonname,hreftype,interfacePath,pageexpandid,isshowlist from mode_customSearchButton where objid="+customid+" and isshow=1  order by showorder asc,id desc");
        while (RecordSet.next()) {
            String buttonname = Util.null2String(RecordSet.getString("buttonname"));
            String hreftype = Util.null2String(RecordSet.getString("hreftype"));
            String classpath = Util.null2String(RecordSet.getString("interfacePath"));
            String isshowlist = "1".equals(datashowtype)?"0":Util.null2String(RecordSet.getString("isshowlist"));// 1 直接展示的查询列表上    如果是图片模式的话忽略此设置
            String showButton = "false";

            if(!isshowlist.equals("1")){//只展示在右侧三个...里面的自定义按钮
                if("1".equals(hreftype)){
                    if (!StringHelper.isEmpty(classpath)) {
                        try {
                            object = (PopedomCommonAction)Class.forName(classpath).newInstance();
                            showButton = object.getIsDisplayOperation(modeid,customid,uid,sourceid,buttonname);
                        } catch (Exception e) {
                            showButton = "true";
                        }
                    } else {
                        showButton = "true";
                    }
                }else if("2".equals(hreftype)){
                    showButton = "true";
                }else if("3".equals(hreftype)){
                    if(modeidInt > 0){
                        int pageExpandId = Util.getIntValue(RecordSet.getString("pageexpandid"), 0);
                        String sql = "select issystem,issystemflag from mode_pageexpand where id = " + pageExpandId + " and isbatch = 0 and (issystem = 1 or (issystem = 0 and viewpage = 1)) and modeid = " + modeidInt;
                        rs.executeSql(sql);
                        if(rs.next()){
                            int issystem = Util.getIntValue(rs.getString("issystem"), 0);
                            int issystemflag = Util.getIntValue(rs.getString("issystemflag"),0);
                            ExpandBaseRightInfo expandBaseRightInfo = new ExpandBaseRightInfo();
                            expandBaseRightInfo.setUser(user);
                            boolean hasRightOfPageExpand = expandBaseRightInfo.checkExpandRight(String.valueOf(pageExpandId), modeid, sourceid);
                            if(hasRightOfPageExpand){
                                if (issystem==1&&(issystemflag==3||issystemflag == 4)) {//需要进行编辑权限判断
                                	boolean haveEdit = this.haveRight(formid, user, modeidInt, sourceid, "edit");
                                	if (haveEdit) {
                                		showButton = "true";
									}
								}else if (issystem==1&&issystemflag == 5) {//需要进行删除权限判断
									boolean haveDel = this.haveRight(formid, user, modeidInt, sourceid, "del");
                                	if (haveDel) {
                                		showButton = "true";
									}
								}else {//不需要进行权限判断
									showButton = "true";
								}
                            }
                        }
                    }
                }else if("5".equals(hreftype) || "6".equals(hreftype)){
                    showButton = "true";
                }
            }
            result.add(showButton);
        }
        return result;
    }

    /**
     * 查询列表操作按钮判断
     */
    public String getSearchResultOperation1(String sourceid, String para){
    	List<String> list=getSearchResultOperation(sourceid,para);
    	String result="";
    	for(String str:list){
    		result+=str+"+";
    	}
    	if(result.endsWith("+")){
    		result=result.substring(0,result.length()-1);
    	}
        return result;
    }

    /**
     * 数据ID
     * @param fieldvalue
     * @param paraTwo
     * @return
     */
    public String getDataId(String fieldvalue,String paraTwo){
        return fieldvalue;
    }

    /**
     * 获取浏览按钮连接url
     * @param type
     * @return
     */
    public static String getBrowserLinkurl(String type){
    	BrowserConfigComInfo browserConfigComInfo  = new BrowserConfigComInfo();
        String linkurl = Util.null2String(browserConfigComInfo.getLinkurl(type));
        if(StringHelper.isEmpty(linkurl)){
        	if("9".equals(type)||"37".equals(type)){
        		linkurl = ""+weaver.general.GCONST.getContextPath()+"/spa/document/index.jsp?id=";
        	}else if("142".equals(type)){
                linkurl = ""+weaver.general.GCONST.getContextPath()+"/spa/odoc/static/index.html#/main/offical/recPostUnit?receiveUnitId=";
            }

        }
        if (Util.getIntValue(type, 0) > 0) {
            if ("".equals(linkurl)) {
            	BrowserComInfo browserComInfo = new BrowserComInfo();
                linkurl = Util.null2String(browserComInfo.getLinkurl(type));
            }
        }
        //与com.api.browser.util.BrowserInitUtil 保持一致
        if("16".equals(type) || "152".equals(type) || "171".equals(type) || "238".equals(type)){
            linkurl = "/workflow/request/ViewRequestForwardSPA.jsp?isrequest=1&requestid=";
        }
       return linkurl;
    }

    public String getOthers (String fieldvalue,String paraTwo) {
    	return getOthers(fieldvalue,paraTwo,null);
    }


    /**
     * 获得自定义显示字段的显示内容
     * @param paraTwo  字段ID+"+"+字段类型+"+"+字段类型+"+"+显示语言
     * @return 显示内容
     */
    public String getOthers (String fieldvalue,String paraTwo,RecordSet rs_page) {
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        int topColumnValue = 0;//置顶列的value
        //获取置顶列的具体列名称
        String topColumnName= getColumnName(rs_page);
        //用于显示置顶的TOP图标
        String tophtmlWithMarginString =   "<span style='background-color:#ff9000;margin-left:12px;border-radius:2px;color:white;font-weight:500;font-size:9px;transform:scale(0.8);display:inline-block;padding:1px 5px;height:16px;line-height:14px;'>TOP</span>";
        String tophtmlWithOutMarginString = "<span style='background-color:#ff9000;border-radius:2px;color:white;font-weight:500;font-size:9px;transform:scale(0.8);display:inline-block;padding:1px 5px;height:16px;line-height:14px;'>TOP</span>";

        String sql = "";
        boolean issumcolumn = false;
        String paraTwoold = paraTwo;
        if(paraTwo.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            paraTwo = paraTwo.replace("+$issumcolumn$","");
        }
        boolean isshowmethod = false;
        if(paraTwo.indexOf("noshowmethod")>-1){
            isshowmethod = true;
            paraTwo = paraTwo.replace("+noshowmethod", "");
        }
        if(!"".equals(topColumnName)){
            topColumnValue = Util.getIntValue(rs_page.getString(topColumnName),0);
        }
        String modeuuid="";
        if(null != rs_page){
            modeuuid = Util.null2String(rs_page.getString("modeuuid"));
        }
        String sliderPercentage = "";
        String isEdit = "";
        String detailtablename = "";
        String detailid = "";
        int qfws=2;
        //如果模块查询中包含有明细表 明细表的表面与明细数据id以+相连 以'与其他参数隔开 即 id+'+d_id+detailtable'
		if(paraTwo.indexOf("'")!=-1){
    		String[] strs = paraTwo.split("'");
    		String detailstr=strs[1];
    		String[] detail=Util.TokenizerString2(detailstr, "+");
    		detailtablename=detail[1];
    		detailid=detail[0];
    		paraTwo=strs[0];
    		if(strs.length>2){
    			String[] split = strs[2].split("\\+");
    			if (split.length>2) {
    				sliderPercentage = split[1];
    				qfws=Util.getIntValue(split[2],2);
				}
    			if(split.length>3){
    				isEdit= split[3];
    			}
            }
		}else {//非明细表
		    String [] arr = paraTwo.split("\\+");
			qfws=arr.length>19?Util.getIntValue(arr[19],2):2;
		}
        String[] tempStr = Util.splitString(paraTwo, "+");
        String modedataid = Util.null2String(tempStr[0]);
        int pcount = tempStr.length-21;//添加处理虚拟表单主键字段含有加号的逻辑，
        if(pcount>0){
            modedataid = "";
            for (int i = 0; i < pcount+1; i++) {
                modedataid += "+"+tempStr[i];
            }
            modedataid = modedataid.substring(1);
        }else{
            pcount=0;
        }
        String fieldid = Util.null2String(tempStr[1+pcount]);
        String fieldhtmltype = Util.null2String(tempStr[2+pcount]);
        String fieldtype = Util.null2String(tempStr[3+pcount]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4+pcount]));
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5+pcount]);
        String dbtype = Util.null2String(tempStr[6+pcount]);
        String istitle = Util.null2String(tempStr[7+pcount]);
        if(issumcolumn){
            istitle = "0";
        }
        String formmodeid = Util.null2String(tempStr[8+pcount]);
        String formID = Util.null2String(tempStr[9+pcount]);
        String viewtype = Util.null2String(tempStr[10+pcount]);
        String ismaplocation ="";
        if(tempStr.length>11){
            ismaplocation= Util.null2String(tempStr[11+pcount]);
        }
        boolean isVirtualForm = "1".equals(modeFormComInfo.getIsVirtualForm(formID));
        String repordid = "";
        if(tempStr.length>=14) {
            repordid = Util.null2String(tempStr[13 + pcount]);
        }
        //this.formmodeLog.writeLog("查询列>>>"+paraTwo);
        /**无权限列表处理*/
        String norightlist = customSearchComInfo.getNoRightList(repordid);
        String vdatasource = "";
        String vprimarykey = "id";
        if(isVirtualForm){
            vdatasource = Util.null2String(modeFormComInfo.getVDataSource(formID));
            vprimarykey = Util.null2String(modeFormComInfo.getVPrimaryKey(formID));	//主键列名称
        }
        int opentype = 0;
        int customid = 0;
        String showmethod = "";
        int userid = 0;
        int enabled = -1;
        boolean isenabled = false;
        String viewfrom = "";//来源
        RecordSet recordSet = new RecordSet();
        StringBuffer sqlStr = new StringBuffer();
        String tablename = workflowBillComInfo.getTablename(formID);
        if(isVirtualForm){
	         if("2".equals(modeFormComInfo.getVformtype(Util.getIntValue(formID)))){
	        	 tablename =modeFormComInfo.getVsql(Util.getIntValue(formID))+" cube_vsql";
  	         }else{
  	        	tablename = VirtualFormHandler.getRealFromName(tablename);
  	         }
        }
        String pageid = CubeUtil.getPageId(repordid);
        HashMap<String, HashMap<String, Object>> thisCache = cache.get(pageid);
        if(thisCache == null) {
            thisCache = new HashMap<String, HashMap<String, Object>>();
            cache.put(pageid, thisCache);
        }

        HashMap<String, Object> dataMap = thisCache.get("data");
        if(dataMap==null) {
            dataMap = new HashMap<String, Object>();
            thisCache.put("data", dataMap);
        }
        if((formmodeid.equals("0")||formmodeid.equals("virtual")) && rs_page != null){
            formmodeid = Util.null2String(rs_page.getString("formmodeid"),"0");
        }

        if(tempStr.length>14){
            opentype = Util.getIntValue(tempStr[12+pcount],0);
            customid = Util.getIntValue(tempStr[13+pcount],0);
            viewfrom = Util.null2String(tempStr[14+pcount]);
        }
        String detailTable=customSearchComInfo.getDetailTable(customid+"");
        if(isEdit.equals("")&&tempStr.length>20){
        	isEdit = Util.null2String(tempStr[20+pcount]);
        }
        if(tempStr.length>15){
            showmethod = Util.null2String(tempStr[15+pcount]);
        }

        isenabled = customSearchComInfo.getEnabled(customid+"");
        if(tempStr.length>16){
            userid = Util.getIntValue(tempStr[16+pcount]);
            enabled = Util.getIntValue(tempStr[17+pcount]);
        }

        if(isshowmethod){
            showmethod = "0";
        }
        Map selectMap = new HashMap<String,String>();
        boolean isfrontmultlang="1".equals(modeComInfo.getIsfrontmultlang(formmodeid));
        String datashowtype = customSearchComInfo.getDatashowtype(""+customid);
        try{
            if (fieldtype.equals("118")) {
                returnStr="<a href=\""+weaver.general.GCONST.getContextPath()+"/meeting/report/MeetingRoomPlan.jsp\" target=\"_blank\">"+ SystemEnv.getHtmlLabelName(2193,userlanguage)+"</a>";
            }
            if(fieldhtmltype.equals("1") ){  // 单行
                if((fieldtype.equals("2")||fieldtype.equals("3")||fieldtype.equals("4")||fieldtype.equals("5"))&&fieldvalue.indexOf("desensitization__")>-1){
                    return fieldvalue;
                }
        		if(fieldhtmltype.equals("1") && fieldtype.equals("4")){
        			returnStr = Util.toDecimalDigits(fieldvalue,2);
        		}else if(fieldtype.equals("3")||fieldtype.equals("5")){
        			int decimaldigits_t=2;
        			if(fieldtype.equals("3") && dbtype.indexOf(",") > -1){
						decimaldigits_t = Util.getIntValue(dbtype.substring(dbtype.indexOf(",") + 1, dbtype.length() -1 ), 2);
					}
        			if (fieldtype.equals("5")) {//千分位保留几位小数以qfws为准
                        String [] arr = paraTwo.split("\\+");
                        if(qfws==2 && paraTwo.indexOf("'") == -1 && arr.length<19){//如果参数中没指定小数，则以实际值为准
                            try{
                                int qfwsTrue = fieldvalue.split("\\.")[1].length();
                                decimaldigits_t = qfwsTrue>0 && qfwsTrue<=4 ? qfwsTrue:qfws;
                            }catch (Exception e){
                            }
                        }else{
                            decimaldigits_t=qfws;
                        }
					}
        			fieldvalue=fieldvalue.replaceAll(",","");//金额千分位先去掉,方便下面的保留小数
    				if(!"".equals(fieldvalue)){
	        			BigDecimal b=new BigDecimal(fieldvalue);
	        			b.setScale(decimaldigits_t,BigDecimal.ROUND_HALF_UP);
	        			returnStr = Util.toDecimalDigits(b.toPlainString(), decimaldigits_t);
	        			//如果是千分位
	        			returnStr = fieldtype.equals("5")?changeToThousands(returnStr):returnStr;
	        			fieldvalue = returnStr;
    				}

        		}else if(isVirtualForm&&fieldtype.equals("-4")){// 标签
                    return getTabName(fieldvalue,"modeid:"+formmodeid);
                }else if(isVirtualForm&&fieldtype.equals("-5")){//草稿
                    return getModedatastatus(fieldvalue,userlanguage+"");
                }else{
        			returnStr=  toHtmlSearch(fieldvalue);
					returnStr = returnStr.replaceAll("<", "&lt;");
        			returnStr = returnStr.replaceAll(">", "&gt;");
                    if(returnStr.indexOf("&times")>-1){
                       returnStr = returnStr.replaceAll("&times", "&amp;times");
                    }
        		}
        		if (("1".equals(fieldtype)&&"1".equals(fieldhtmltype))) {//如果没有开启前端多语言,值要转换
        			returnStr=CubeCipherUitl.decrypt(returnStr);
        			if (isfrontmultlang&&"true".equals(isEdit)) {
        				returnStr=TextUtil.toBase64ForMultilang(returnStr+"");
					}else {
						returnStr=Util.formatMultiLang(returnStr, userlanguage+"");
					}
				}
        		if("true".equals(isEdit)){
        			return returnStr;
        		}

        	}else if(fieldhtmltype.equals("2")){//多行文本框
        		fieldvalue = Util.null2String(fieldvalue);
        		String tempString = fieldvalue;
                if(tempString.indexOf("&times")>-1){
                       tempString = tempString.replaceAll("&times", "&amp;times");
                }
            	if(isEdit.equals("true")&&fieldtype.equals("1")){
            		returnStr=tempString.replace("\n", "<br/>");//避免被Dao_TableSqlServer中convert掉
                    if(returnStr.contains("<br>")){//QC681437 流程转数据的数据在数据库中存<br>来换行,取出来时需要替换为<br/>
                        returnStr=returnStr.replace("<br>","<br/>");
                    }
                    returnStr=returnStr.replace("&nbsp;"," ");
                    returnStr=returnStr.replace("&gt;",">");
                    returnStr=returnStr.replace("&lt;","<");
            	}else{
                    if(fieldtype.equals("1")){
                        tempString=tempString.replace("<br>", "\n");//流程转数据过来的数据
                        String[] tempFieldValue = fieldvalue.split("<p>|</p>|<script>initFlashVideo\\(\\);</script>|<br>");
    	            	for(int i=0;i<tempFieldValue.length;i++){
    	            		String temp = tempFieldValue[i].replaceAll("<", "&lt;");
    	            		temp = temp.replaceAll(">", "&gt;");
    	            		tempString = tempString.replace(tempFieldValue[i], temp);
    	            	}
    	            	if(!tempString.isEmpty()){
    	            		tempString = "<p>"+tempString.replaceAll("\n", "<br/>")+"</p>";
    	            	}
            		}else if(fieldtype.equals("2")){
                        // title导致乱码解决
                        /*String[] tempFieldValue = fieldvalue.split("title");
                        for(int i=1;i<tempFieldValue.length;i++){
                            String titleTemp = tempFieldValue[i].substring(tempFieldValue[i].indexOf("\""));
                            titleTemp= titleTemp.substring(0,titleTemp.indexOf("\""));
                            String temp = titleTemp.replaceAll("<", "&lt;");
                            temp = temp.replaceAll(">", "&gt;");
                            tempString = tempString.replace(tempFieldValue[i], tempFieldValue[i].replace(titleTemp,temp));
                        }*/
                        if(!tempString.isEmpty()){
                            tempString = "<p>"+tempString.replaceAll("\n", "</p>\n<p>")+"</p>";
                        }
                    }
                	tempString = tempString.replaceAll("&#39;", "'");
                	tempString = tempString.replaceAll("<br>","");
            		String reg="[\u0000-\u001f|\ufffd|囧|]";
            		returnStr = "<span>"+tempString+"</span>";
            	}
        	} else if(fieldhtmltype.equals("3")){                         // 浏览按钮 (涉及workflow_broswerurl表)
                boolean isauthorize = false;
                String authorizeparam = "";
                int modeid = Util.getIntValue(formmodeid, 0);
                int formid = Util.getIntValue(formID, 0);
                if(modeid != 0){
                    List<String> authorizeFileids = new ArrayList<String>();
                    HashMap authorizeFileidsMap = thisCache.get("authorizeFileidsMap");
                    if(authorizeFileidsMap==null) {
                        authorizeFileidsMap = new HashMap<String, Object>();
                        authorizeFileids = getAuthorizeFieldids(modeid, formid);
                        authorizeFileidsMap.put("authorizeFileids", authorizeFileids);
                        thisCache.put("authorizeFileidsMap", authorizeFileidsMap);
                    }else{
                        authorizeFileids = (List<String>)authorizeFileidsMap.get("authorizeFileids");
                    }
                    isauthorize = authorizeFileids.contains(fieldid);
                    if(isauthorize){
                        authorizeparam="&formmode_authorize=formmode_authorize&moduleid=formmode&authorizemodeId="+formmodeid+"&authorizefieldid="+fieldid;
                        //监控列表
                        if("3".equals(viewtype)){
                            authorizeparam+="&authorizeformmodebillId=-9999";
                        }else{
                            authorizeparam+="&authorizeformmodebillId="+modedataid;
                        }
                    }
                }

                if(fieldtype.equals("2") || fieldtype.equals("19") ){    // 日期和时间
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("290")){//时间日期字段
                    //returnStr="".equals(Util.null2String(fieldvalue))?"":new DateTransformer().getLocaleDateTime(fieldvalue);
                    returnStr=fieldvalue;
                    if(returnStr!=null && returnStr.indexOf(":")!=returnStr.lastIndexOf(":")){
                        returnStr = returnStr.substring(0,returnStr.lastIndexOf(":"));
                    }
                } else if(fieldtype.equals("402") || fieldtype.equals("403") ){//年、年月
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("224")||fieldtype.equals("225") ||fieldtype.equals("226")||fieldtype.equals("227")){
                    returnStr=fieldvalue;
                }else  if(fieldtype.equals("298")){//账套
                    returnStr=new AccountInfoComInfo().getAccountName(fieldvalue);
                }else if(!fieldvalue.equals("")) {
                    String linkurl= getBrowserLinkurl(fieldtype);;    // 浏览值点击的时候链接的url
                    StringBuffer showname = new StringBuffer();                                                   // 值显示的名称
                    String showid = "";                                                     // 值
					showname.setLength(0);
					String shownametemp = "";//值的显示名称
					ArrayList tempshowidlist=Util.TokenizerString(fieldvalue,",");
                    if(fieldtype.equals("8") || fieldtype.equals("135")){
                        //项目，多项目
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                               // showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                                //showname.append("<a href=\"").append(linkurl).append(tempshowidlist.get(k)).append("\" target=\"_new\">").append(ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("\") >").append(ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            }else{
                                //showname+=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+" ";
                                showname.append(ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))).append(" ");
                            }
                            shownametemp +=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+",";
                        }
                    }else if(fieldtype.equals("1") ||fieldtype.equals("17")||fieldtype.equals("165") ||fieldtype.equals("166")){
                        //人员，多人员
                        for(int k=0;k<tempshowidlist.size();k++){
                        	//showname+="<a href=javaScript:openhrm("+tempshowidlist.get(k)+") onclick=pointerXY(event)>"+rc.getResourcename((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            showname.append("<a href=javaScript:openhrm(").append(tempshowidlist.get(k)).append(") onclick=pointerXY(event)>").append(rc.getResourcename((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            shownametemp +=rc.getResourcename((String)tempshowidlist.get(k))+",";
                        }
                    }else if(fieldtype.equals("7") || fieldtype.equals("18")){
                        //客户，多客户
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                              //  showname+="<a href=\""+linkurl+tempshowidlist.get(k)+authorizeparam+"\" target=\"_new\">"+cci.getCustomerInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                                //showname.append("<a href=\"").append(linkurl).append(tempshowidlist.get(k)).append(authorizeparam).append("\" target=\"_new\">").append(cci.getCustomerInfoname((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append(authorizeparam).append("\") >").append(cci.getCustomerInfoname((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            }else{
                              //  showname+=cci.getCustomerInfoname((String)tempshowidlist.get(k))+" ";
                                showname.append(cci.getCustomerInfoname((String)tempshowidlist.get(k))).append(" ");
                            }
                            shownametemp +=cci.getCustomerInfoname((String)tempshowidlist.get(k))+",";
                        }
                    }else if(fieldtype.equals("4") || fieldtype.equals("57")|| fieldtype.equals("167")|| fieldtype.equals("168")){
                        //部门，多部门，单权部门，单权多部
                        orgShowBiz = new OrganizationShowSetBiz();
						String sepCharacter = orgShowBiz.getSepCharacter();
                        for(int k=0;k<tempshowidlist.size();k++){
                        	if(!"0".equals(Util.null2String(tempshowidlist.get(k)))){
								String departmentShow = orgShowBiz.getDepartmentShow("model", (String)tempshowidlist.get(k));
                        	    if(sepCharacter.equals(departmentShow)){
                                    departmentShow = "";
                                }
                                if(!linkurl.equals("") ){
                                  //  showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+departmentShow+"</a>&nbsp;";
                                    //showname.append("<a href=\"").append(linkurl).append(tempshowidlist.get(k)).append("\" target=\"_new\">").append(departmentShow).append("</a>&nbsp;");
                                	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("\") >").append(departmentShow).append("</a>&nbsp;");
                                    shownametemp += departmentShow+",";
                                }else{
									if(!departmentShow.equals("") ){
										//showname+=departmentShow+" ";
										showname.append(departmentShow).append(" ");
                                        shownametemp += departmentShow+",";
									}
                                }

                        	}
                        }
                    }else if(fieldtype.equals("9") || fieldtype.equals("37")){
                        //文档，多文档
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname.append("<br>");

                            {
                                if(!linkurl.equals("")){
                                   // showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"&modedataid="+modedataid+authorizeparam+"\" target=\"_new\">"+DocComInfo1.getDocname((String)tempshowidlist.get(k))+"</a>";
                                    //showname.append("<a href=\"").append(linkurl).append(tempshowidlist.get(k)).append("&modedataid=").append(modedataid).append(authorizeparam).append("\" target=\"_new\">").append(DocComInfo1.getDocname((String)tempshowidlist.get(k))).append("</a>");
                                	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("&modedataid=").append(modedataid).append(authorizeparam).append("\") >").append(DocComInfo1.getDocname((String)tempshowidlist.get(k))).append("</a>");
                                }else{
                                   // showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k));
                                    showname.append(DocComInfo1.getDocname((String)tempshowidlist.get(k)));
                                }
                                shownametemp += DocComInfo1.getDocname((String)tempshowidlist.get(k))+",";
                            }
                        }
                    }else if(fieldtype.equals("22")){
                        //报销费用类型
                        FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo();
                        String separator = Util.null2String(fnaSystemSetComInfo.get_separator()).trim();
                        int enableDispalyAll = Util.getIntValue(fnaSystemSetComInfo.get_enableDispalyAll());
                        String fullName  = "";
                        if(enableDispalyAll == 1){
                            BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo();
                            String [] valueArr = fieldvalue.split(",");
                            for (String keyid : valueArr) {
                                fullName = budgetfeeTypeComInfo.getSubjectFullName(keyid, separator);
                                if(!linkurl.equals("") ){
                                   // showname+="<a href=\'"+linkurl+tempshowidlist.get(Integer.parseInt(keyid))+"\' target=\'_new\'>"+fullName+"</a>&nbsp;";
                                	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(Integer.parseInt(keyid))).append("\") >").append(fullName).append("</a>&nbsp;");
                                }else{
                                   // showname+=fullName+" ";
                                    showname.append(fullName).append(" ");
                                }
                                shownametemp +=fullName+",";
                            }
                        }else{
                            BrowserComInfo bci = new BrowserComInfo();
                            String tablenamefylx = bci.getBrowsertablename(fieldtype+""); // 浏览框对应的表,比如人力资源表
                            String columname = bci.getBrowsercolumname(fieldtype+""); // 浏览框对应的表名称字段
                            String keycolumname = bci.getBrowserkeycolumname(fieldtype+""); // 浏览框对应的表值字段
                            String bxsql = "select " + keycolumname + "," + columname + " from " + tablenamefylx + " where " + keycolumname + " in ( " + fieldvalue + ")";
                            rs.executeSql(bxsql);
                            while (rs.next()) {
                                String tempshowname = Util.null2String(rs.getString(2));
                                if(!linkurl.equals("") ){
                                   // showname+="<a href=\'"+linkurl+tempshowidlist.get(Util.getIntValue(rs.getString(1)))+"\' target=\'_new\'>"+tempshowname+"</a>&nbsp;";
                                	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(Util.getIntValue(rs.getString(1)))).append("\") >").append(tempshowname).append("</a>&nbsp;");
                                }else{
                                  //  showname+=tempshowname+" ";
                                    showname.append(tempshowname).append(" ");
                                }
                                shownametemp +=tempshowname+",";
                            }
                        }
                    }else if(fieldtype.equals("23")){
                        //资产
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                //showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("\") >").append(CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))).append("</a>&nbsp;");
                            }else{
                                //showname+=CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+" ";
                                showname.append(CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))).append(" ");
                            }
                            shownametemp += CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+",";
                        }
                    }else if(fieldtype.equals("16") || fieldtype.equals("152")|| fieldtype.equals("171")){
                        //相关请求
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname.append("<br>");
                            if(!linkurl.equals("")){
                                int tempnum=0;
                                tempnum++;
                              //  showname+="<a href=\""+linkurl.replace("isrequest=1&","")+tempshowidlist.get(k) + authorizeparam+"\" target=\"_new\">"+WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+"</a>";
                                showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl.replace("isrequest=1&","")).append(tempshowidlist.get(k)).append(authorizeparam).append("\") >").append(WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))).append("</a>");
                            }else{
                                //showname+=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k));
                                showname.append(WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k)));
                            }
                            shownametemp +=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+",";
                        }
                    }else if(fieldtype.equals("141")){
                        //人力资源条件
                        //showname+=rcm.getFormShowName(fieldvalue,userlanguage);
                        showname.append(rcm.getFormShowName(fieldvalue,userlanguage));
                    }
                    //added by alan for td:10814
                    else if(fieldtype.equals("142")) {
                        //收发文单位
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                               // showname += "<a href='"+linkurl+tempshowidlist.get(k)+"' target='_new'>"+ duc.getReceiveUnitName(""+tempshowidlist.get(k))+"</a>&nbsp;";
                            	showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("\") >").append(duc.getReceiveUnitName(""+tempshowidlist.get(k))).append("</a>&nbsp;");
                            }else{
                               // showname += duc.getReceiveUnitName(""+tempshowidlist.get(k))+" ";
                                showname.append(duc.getReceiveUnitName(""+tempshowidlist.get(k))).append(" ");
                            }
                            shownametemp += duc.getReceiveUnitName(""+tempshowidlist.get(k))+",";
                        }
                    }
                    else if(fieldtype.equals("161")){//自定义单选
                        showname.setLength(0);                                  // 新建时候默认值显示的名称
                        String showdesc="";
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser) StaticObj.getServiceByFullname(dbtype, Browser.class);
                            Map<String, Object> browserParms = getBrowserParms(browser,rs_page, detailtablename, userlanguage+"");
                            BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, showid,browserParms);
                            String desc=Util.null2String(bb.getDescription());
                            String name=Util.null2String(bb.getName());
                            name = getName(name,datashowtype);
//							showname="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                            name = name.replaceAll("<", "&lt;");
                            name = name.replaceAll(">", "&gt;");
                            desc = desc.replaceAll("<", "&lt;");
                            desc = desc.replaceAll(">", "&gt;");
                            String href=Util.null2String(bb.getHref());
    						if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
    							href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
    						}
                            if(href.equals("")){
                                //showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                showname.append("<span title='").append(desc).append("'>").append(name).append("</span>&nbsp;");
                            }else{
                                String tempcustomid = Util.null2String(browser.getCustomid());
                                href = new ButtonElement().getHrefByBrowser(tempcustomid, href, showid, recordSet);
                                if(isChineseCharacter(href)){
                                  //  showname+="<a title='"+desc+"' href=javascript:openHrefWithChinese(\""+href+authorizeparam+"\")>"+name+"</a>&nbsp;";
                                    showname.append("<a title='").append(desc).append("' href=javascript:openHrefWithChinese(\"").append(href).append(authorizeparam).append("\")>").append(name).append("</a>&nbsp;");
                                }else{
                                  //  showname+="<a title='"+desc+"' href=javascript:openHref(\""+href+authorizeparam+"\") >"+name+"</a>&nbsp;";
                                    showname.append("<a title='").append(desc).append("' href=javascript:cubeOpenHref(\"").append(href).append(authorizeparam).append("\") >").append(name).append("</a>&nbsp;");
                                }
                            }
                            shownametemp +=name +",";
                        }catch(Exception e){
                        }
                    } else if(fieldtype.equals("162")){//自定义多选
                        showname.setLength(0);                                  // 新建时候默认值显示的名称
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            List l=Util.TokenizerString(showid,",");
                            Map<String, Object> browserParms = getBrowserParms(browser, rs_page, detailtablename, userlanguage+"");
                            for(int j=0;j<l.size();j++){
                                String curid=(String)l.get(j);
                                BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, curid,browserParms);
                                String name=Util.null2String(bb.getName());
                                name = getName(name,datashowtype);
                                name = name.replaceAll("<", "&lt;");
                                name = name.replaceAll(">", "&gt;");
                                String desc=Util.null2String(bb.getDescription());
                                desc = desc.replaceAll("<", "&lt;");
                                desc = desc.replaceAll(">", "&gt;");
//							    showname+="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                                String href=Util.null2String(bb.getHref());
        						if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
        							href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
        						}
                                if(href.equals("")){
                                    //showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                    showname.append("<span title='").append(desc).append("'>").append(name).append("</span>&nbsp;");
                                }else{
                                    String tempcustomid = Util.null2String(browser.getCustomid());
                                    href = new ButtonElement().getHrefByBrowser(tempcustomid, href, curid, recordSet);
                                    if(isChineseCharacter(href)){
                                        //showname+="<a title='"+desc+"' href='javascript:openHrefWithChinese(\""+href+authorizeparam+"\");'>"+name+"</a>&nbsp;";
                                        showname.append("<a title='").append(desc).append("' href='javascript:openHrefWithChinese(\"").append(href).append(authorizeparam).append("\");'>").append(name).append("</a>&nbsp;");
                                    }else{
                                        //showname+="<a title='"+desc+"' href=javascript:openHref(\""+href+authorizeparam+"\") >"+name+"</a>&nbsp;";
                                        showname.append("<a title='").append(desc).append("' href=javascript:cubeOpenHref(\"").append(href).append(authorizeparam).append("\") >").append(name).append("</a>&nbsp;");
                                    }
                                }
                                shownametemp += name+",";
                            }
                        }catch(Exception e){
                        }
                    }else if (fieldtype.equals("256")||fieldtype.equals("257")) {//自定义树形单选
                        CustomTreeUtil customTreeUtil = new CustomTreeUtil();
//                        if("1".equals(datashowtype)||"5".equals(datashowtype)){// 相册 纵向列表
//                            customTreeUtil.setReturnDecryptData(true);
//                        }
                        shownametemp=CubeCipherUitl.decryptByRegEx(customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname"));
                        if(this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true") ){
                          //  showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname");
                            showname.append(shownametemp);
                        }else{
                            //showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"openByTreeField",authorizeparam);
                            showname.append(CubeCipherUitl.decryptByRegEx(customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"openByTreeField",authorizeparam)));
                        }
                       // showname=CubeCipherUitl.decryptByRegEx(showname);
                    }else if(fieldtype.equals("164") || fieldtype.equals("194")||fieldtype.equals("170")||fieldtype.equals("169")){      //分部
                        orgShowBiz = new OrganizationShowSetBiz();
                        String sepCharacter = orgShowBiz.getSepCharacter();
                        //分部，多分部，单权分部，单权多分部
                        for(int k=0;k<tempshowidlist.size();k++){
                            String subcompanyShow = orgShowBiz.getSubcompanyShow("model", (String)tempshowidlist.get(k));
                            if(sepCharacter.equals(subcompanyShow)){
                                subcompanyShow = "";
                            }
                            if(!linkurl.equals("") ){
                                //showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+subcompanyShow+"</a>&nbsp;";
                                showname.append("<a ").append(" href=javascript:cubeOpenHref(\"").append(linkurl).append(tempshowidlist.get(k)).append("\") >").append(subcompanyShow).append("</a>&nbsp;");
                                shownametemp +=subcompanyShow+",";
                            }else{
                                if(!subcompanyShow.equals("")) {
									showname.append(subcompanyShow).append(" ");
									shownametemp +=subcompanyShow+",";								}
                            }
                        }
                    }  else if (fieldtype.equals("325")) {
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        String[] valueArr = fieldvalue.split(",");
                        ArchivesUtil archivesUtil = new ArchivesUtil();

                        for (String bizId : valueArr) {
                            String tablename1 = archivesUtil.getTableById(bizId); //浏览框对应的表,比如人力资源表
                            String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                            String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                            HashMap <String, String> tempDataMap = new HashMap <String, String>();
                            sql= "select "+keycolumname+","+columname+" from "+tablename1+" where "+keycolumname+" = '" + bizId + "'";
                            RecordSet.executeSql(sql);
                            if (RecordSet.next()){
                                String tempShowid = Util.null2String(RecordSet.getString(1));
                                String tempshowname = Util.null2String(RecordSet.getString(2));
                                tempDataMap.put(tempShowid, tempshowname);
                                if(!linkurl.equals("") ){
                                    showname.append("<a href=\"javascript:cubeOpenHref('").append(linkurl).append(bizId).append("')\" >").append(Util.toScreen(tempDataMap.get(bizId),userlanguage)).append("</a>&nbsp;");
                                }else{
                                    showname.append(Util.toScreen(tempDataMap.get(bizId),userlanguage)).append(" ");
                                }
                                shownametemp +=tempDataMap.get(bizId)+",";
                            }
                        }
                    } else{
                        String tablename1=BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                        String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                        String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        String[] valueArr = fieldvalue.split(",");
                        String name = "";
                        //2222省份,58城市,263区县
                        if(fieldtype.equals("2222") || fieldtype.equals("58")||fieldtype.equals("263")){
                            HrmCountryCityBiz hrmCountryCityBiz = new HrmCountryCityBiz(fieldtype);
                            name= hrmCountryCityBiz.getPath(fieldvalue, fieldtype);
                        }
                        HashMap <String, String> tempDataMap = new HashMap <String, String>();
                        if(fieldvalue.indexOf(",")!=-1){
                            sql= "select "+keycolumname+","+columname+" from "+tablename1+" where "+keycolumname+" in( "+fieldvalue+")";
                        }
                        else {
                            sql= "select "+keycolumname+","+columname+" from "+tablename1+" where "+keycolumname+"="+fieldvalue;
                        }
                        RecordSet.executeSql(sql);
                        while(RecordSet.next()){
                            String tempShowid = Util.null2String(RecordSet.getString(1));
                            String tempshowname = Util.null2String(RecordSet.getString(2));
                            tempDataMap.put(tempShowid, tempshowname);
                        }

                        for (String id : valueArr) {
                            if(!linkurl.equals("") ){
                                //showname += "<a href=\"javascript:openHref('"+linkurl+RecordSet.getString(1)+"')\" >"+Util.toScreen(RecordSet.getString(2),userlanguage)+"</a>&nbsp;";
                                showname.append("<a href=\"javascript:cubeOpenHref('").append(linkurl).append(id).append("')\" >").append(name).append(Util.toScreen(tempDataMap.get(id),userlanguage)).append("</a>&nbsp;");
                            }else{
                                //showname +=Util.toScreen(RecordSet.getString(2),userlanguage)+" ";
                                showname.append(name).append(Util.toScreen(tempDataMap.get(id),userlanguage)).append(" ");
                            }
                            shownametemp +=tempDataMap.get(id)+",";
                        }// end of while
                    }

					if(shownametemp.endsWith(",")){
                        shownametemp = shownametemp.substring(0,shownametemp.length()-1);
                    }
                    if("1".equals(datashowtype)){//图片看板
                        returnStr=shownametemp+"|||"+showname.toString();
                    }else{
                        returnStr=showname.toString();
                    }                }
            }                                                       // 浏览按钮条件结束
            else if(fieldhtmltype.equals("4")) {                    // check框
                returnStr=fieldvalue;
            }                                                       // check框条件结束
            else if(fieldhtmltype.equals("5") ||fieldhtmltype.equals("-9")){     //    fieldhtmltype= -9 门户数查询做的特殊处理            // 选择框   select
                // 查询选择框的所有可以选择的值
                //根据fieldid 判断是否是密级字段如果是调用人力资源那边的工具类返回对应的信息
//                String sqlQueryIsSeclevel = " select count(1) as count from WORKFLOW_BILLFIELD where id = "+fieldid +" and fieldname='seclevel' ";
//                RecordSet rsQuerySeclevel = new RecordSet();
//                boolean queryIsSeclevelFlag = rsQuerySeclevel.executeSql(sqlQueryIsSeclevel);
//                int seclevelCount = 0;
//                if(queryIsSeclevelFlag && rsQuerySeclevel.next()){
//                    seclevelCount =Util.getIntValue(rsQuerySeclevel.getString("count"));
//                }
                if("-9".equals(fieldid)){
                    Map<String, Object> param = new HashMap<>();
                    param.put("selectMap", selectMap);
                    param.put("userlanguage", userlanguage);
                    param.put("fieldvalue", fieldvalue);
                    param.put("returnStr", returnStr);
                    AddSeclevelUtil addSeclevelUtil = new AddSeclevelUtil();
                    Map<String, Object> seclevelMap = addSeclevelUtil.getSeclevelOption(param);
                    returnStr = seclevelMap.get("returnStr") + "";
                    selectMap = (Map) seclevelMap.get("selectMap");

                }else{
                    rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+isbill);
                    while(rs.next()){
                        String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                        String tmpselectname = Util.toScreen(rs.getString("selectname"),userlanguage);
                        List l=Util.TokenizerString(fieldvalue,",");
                        if(l.contains(tmpselectvalue)){
                            returnStr += ","+tmpselectname;
                        }
                        selectMap.put(tmpselectvalue, tmpselectname);
                    }
                }
                if(!returnStr.isEmpty()){
                	returnStr = returnStr.substring(1);
                }
            }else if(fieldhtmltype.equals("6")){ //文档（附件）
                if(!fieldvalue.equals("")) {
                    returnStr = getFileHTMLStr(fieldvalue, modedataid, fieldid, fieldtype,
							userlanguage, formmodeid, formID, viewtype, norightlist, customid);
                }
            }else if(fieldhtmltype.equals("7")){                     // 特殊字段
                rs.executeQuery("select displayname,linkaddress,descriptivetext from workflow_specialfield where fieldid=?", fieldid);
                while(rs.next()){
                	String displayname=Util.null2String(rs.getString("displayname"));
                	String linkaddress=Util.null2String(rs.getString("linkaddress"));
                	String descriptivetext=Util.null2String(rs.getString("descriptivetext"));
                	if(fieldtype.equals("1")){
                		returnStr = "<a title='"+displayname+"' href=javascript:cubeOpenHref(\""+linkaddress+"\")>"+displayname+"</a>&nbsp;";
                    }else if(fieldtype.equals("2")){
                    	returnStr = descriptivetext;
                    }
                }
                
            }else if(fieldhtmltype.equals("8")){                     // 公共选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeSql("select * from mode_selectitempagedetail where id='"+fieldvalue+"'");
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("id"));
                    String tmpselectname = Util.toScreen(rs.getString("name"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }
        } catch (Exception e) {
            new BaseBean().writeLog(e);
            returnStr="";
        }
        String urlStart = "<a ";
        String urlEnd = "</a>";
        String className = " ";

        String tempreturnStr = returnStr;
        //根据条件

        if ("1".equals(showmethod)&&!"6".equals(fieldhtmltype)){//&&!istitle.equals("1") && !istitle.equals("2") && !istitle.equals("3")
            Map<String,String> showmethodParamMap = new HashMap();
            if(fieldhtmltype.equals("5")){
            	String[] arr = fieldvalue.split(",");
            	String str = "";
            	for (int i = 0; i < arr.length; i++) {
//					if(!StringHelper.isEmpty(arr[i])){
						showmethodParamMap = this.changeShowmethod2(userid,customid, modedataid, detailid, fieldid, arr[i], returnStr, paraTwoold, null,selectMap);
						str  += Util.null2String(showmethodParamMap.get("retstr"));
//					}
				}
            	returnStr = str;
            }else{
            	showmethodParamMap = this.changeShowmethod2(userid,customid, modedataid, detailid, fieldid, fieldvalue, returnStr, paraTwoold, null,null);
            	returnStr  = Util.null2String(showmethodParamMap.get("retstr"));
            }
            urlStart = "<div ";
            urlEnd = "</div>";
            className = " class=\'cube-list-divForLinkedUrl\' ";
        }

        if(fieldtype.equals("1")&&ismaplocation.equals("1")&&!fieldvalue.equals("")){
            returnStr="<i class='icon-coms-position' style=\"color:#2db7f5;vertical-align: middle;\" onClick=\"showFormModeMap('"+CubeCipherUitl.decrypt(fieldvalue)+"','D')\" ></i>"+returnStr;
        }
        
        if (issumcolumn) {
            return returnStr;
        }
        HashMap<String, Object> mode_barcodeMap = thisCache.get("mode_barcode");
        if(mode_barcodeMap == null) {
            mode_barcodeMap = new HashMap<String, Object>();
            thisCache.put("mode_barcode", mode_barcodeMap);
        }
        String mode_barcode =  (String) mode_barcodeMap.get("formmodeid");
        // 条形码验证逻辑 放弃使用缓存 在各种模式下进行切换的时候会存在问题，分组和其他列表不能使用同一个缓存逻辑（缓存逻辑不清楚，直接走数据库）
//        String isTreeSearch = customSearchComInfo.getTreeSearch(customid+"");
//        if("1".equals(isTreeSearch)){
            //如果returnStr转换的字段是“#BARCodeImg#”则需要解析成条形码
           if(!"".equals(formmodeid)){
                sql = "select * from mode_barcode where modeid='"+formmodeid+"' and isused=1";
                recordSet.executeSql(sql);
                if(recordSet.next()){
                    mode_barcode = "1";
                    mode_barcodeMap.put("formmodeid", mode_barcode);
                }else{
                    mode_barcode = "0";
                }
			}else{
				mode_barcode = "0";
			}
//        }else{
//            if(mode_barcode==null&&!"".equals(formmodeid)) {
//
//                //如果returnStr转换的字段是“#BARCodeImg#”则需要解析成条形码
//                sql = "select * from mode_barcode where modeid="+formmodeid+" and isused=1";
//                recordSet.executeSql(sql);
//                if(recordSet.next()){
//                    mode_barcode = "1";
//                    mode_barcodeMap.put("formmodeid", mode_barcode);
//                }
//            }
//        }

        if("1".equals(mode_barcode)) {
            returnStr = returnStr.replaceAll("#BARCodeImg#","<img src='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.formmode.servelt.BARcodeBuildAction?modeid="+formmodeid+"&formid="+formID+"&billid="+modedataid+"&customid="+customid+"'>");

        }
        if(returnStr.indexOf("#BARCodeImg#") > -1){
            returnStr = tempreturnStr;
            urlStart = "<a ";
            urlEnd = "</a>";
            className = " ";
        }

        boolean canSetTitle =  FieldUtil.canSetTitle(fieldhtmltype, fieldtype, fieldid);

        //单行文本和下拉字段的值可以作为标题
        if (canSetTitle && !istitle.equals("0")) {
            if("3".equals(fieldhtmltype)){
                if("1".equals(datashowtype)&&returnStr.indexOf("|||")>=0){//图片看板
                    returnStr=returnStr.split("\\|\\|\\|")[1];
                }
                returnStr = Util.HTMLtoTxt(returnStr);
                tempreturnStr = returnStr;
            }
            String hreflink="";
                String custmomfield = "select hreflink from Mode_CustomDspField where fieldid="+fieldid+" and customid="+customid;
            RecordSet.executeSql(custmomfield);
            if (RecordSet.next()) {
                hreflink = Util.null2String(RecordSet.getString("hreflink"));


            }
            modedataid=modedataid.replaceAll(" ", "%20");//虚拟表单主键中含有空格需要转义,否则最终href解析会错误
            hreflink=getHreflink(hreflink,"type",viewtype);
            hreflink=getHreflink(hreflink,"modeId",formmodeid);
            hreflink=getHreflink(hreflink,"formId",formID);
            hreflink=getHreflink(hreflink,"billid",modedataid);
            hreflink=getHreflink(hreflink,"opentype",Util.null2String(opentype));
            hreflink=getHreflink(hreflink,"customid",Util.null2String(customid));
            hreflink=getHreflink(hreflink,"viewfrom",Util.null2String(viewfrom));
            hreflink=getHreflink(hreflink,"modeuuid",modeuuid);
            hreflink=getHreflink(hreflink,"workcode",Util.null2String(this.rc.getWorkcode(""+userid)));
            String requestid = "0";
            if (null != rs_page) {
                requestid = Util.null2String(rs_page.getString("requestid"));
            }
            hreflink=getHreflink(hreflink,"requestId",requestid);
            HashMap<String, Object> frommainfieldMap = thisCache.get("frommainfield");
            if(frommainfieldMap==null) {
                frommainfieldMap = new HashMap<String, Object>();
                thisCache.put("frommainfield",frommainfieldMap);
            }
            ArrayList<String> fieldArray =  (ArrayList<String>) frommainfieldMap.get(formID);
            if(fieldArray==null) {
                fieldArray = new ArrayList<String>();
                frommainfieldMap.put(formID, fieldArray);
                RecordSet RecordSetfield = new RecordSet();
                String fieldsql = "select * from workflow_billfield where billid="+formID+" and (detailtable ='' or detailtable is null)";
                RecordSetfield.executeSql(fieldsql);
                while(RecordSetfield.next()){
                    String fieldhtype = RecordSetfield.getString("fieldhtmltype");
                    String type = RecordSetfield.getString("type");
                    String fieldname = RecordSetfield.getString("fieldname");
                    if("2".equals(fieldhtype)&&"2".equals(type)){
                        continue;
                    }
                    fieldArray.add(fieldname);
                }

                //如果模块查询中含有明细表 查询出明细表中的字段名 查询格式为 dt.明细字段
                if(!StringHelper.isEmpty(detailtablename)){
                    String detailfieldsql = "select * from workflow_billfield where billid="+formID+" and detailtable ='"+detailtablename+"' ";
                    RecordSetfield.executeSql(detailfieldsql);
                    while(RecordSetfield.next()){
                        String fieldhtype = RecordSetfield.getString("fieldhtmltype");
                        String type = RecordSetfield.getString("type");
                        String fieldname = RecordSetfield.getString("fieldname");
                        if("2".equals(fieldhtype)&&"2".equals(type)){
                            continue;
                        }
                        fieldArray.add("dt."+fieldname);
                    }
                }
            }

            if (null != rs_page) {
                String encryptTable = "";
                for(String fieldname : fieldArray) {
                    encryptTable = tablename;
                    String value = Util.null2String(rs_page.getString(encryptTable,fieldname.toLowerCase()));
                    if(fieldname.startsWith("dt.")){
                        encryptTable = detailTable;
                        value = Util.null2String(rs_page.getString(encryptTable,fieldname.replaceFirst("dt.","d_").toLowerCase()));
                    }
                    value = EncryptConfigBiz.getDecryptData(value);
                    hreflink = Util.replaceString2(hreflink, "\\$"+fieldname+"\\$",value);
                }
            }

            String titleStr = returnStr;
            if(titleStr.indexOf("'")!=-1){
                titleStr = titleStr.replace("'", "&#39;");
                //titleStr = titleStr.replace("'", "%27;");
            }
            hreflink=Util.null2String(hreflink);
            hreflink=hreflink.replaceAll(" ", "%20");//链接中含有空格需要转义,否则最终href解析会错误
            hreflink=CubeCipherUitl.decryptByRegEx(hreflink);
            String removeStatusIconForMode = "";
            if(isenabled&&!isVirtualForm&&enabled!=-1){
                removeStatusIconForMode = "removeStatusIconForMode(true,"+modedataid+");";
            }
			  //需要显示数据状态
            if(isenabled&&!isVirtualForm&&enabled!=-1){
                // 限制只有链接字段为表单建模时，才有未读标识 1-为表单建模字段 2-为工作流
                if (istitle.equals("1")){
                    if(enabled==1){
                        returnStr +="<span id=\"span"+modedataid+"\"><img class=\'statusiconformmode_"+modedataid+"\' title='"+SystemEnv.getHtmlLabelName(83818, userlanguage)+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew_wev8.png\" complete=\"complete\"/></span>";//未读数据
                    }else if(enabled==2){
                        returnStr +="<span id=\"span"+modedataid+"\"><img class=\'statusiconformmode_"+modedataid+"\' title='"+SystemEnv.getHtmlLabelName(83821, userlanguage)+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew2_wev8.png\" complete=\"complete\"/></span>";//反馈数据
                    }else if(enabled==0){
                        //查询数据状态未选时，则需要判断数据状态
                        int isnewimage = isNewimage(formmodeid,modedataid,userid);
                        if(isnewimage==1){
                            returnStr +="<span id=\"span"+modedataid+"\"><img class=\'statusiconformmode_"+modedataid+"\' title='"+SystemEnv.getHtmlLabelName(83818, userlanguage)+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew_wev8.png\" complete=\"complete\"/></span>";//未读数据
                        }else if(isnewimage==2){
                            returnStr +="<span id=\"span"+modedataid+"\"><img class=\'statusiconformmode_"+modedataid+"\' title='"+SystemEnv.getHtmlLabelName(83821, userlanguage)+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew2_wev8.png\" complete=\"complete\"/></span>";//反馈数据
                        }
                    }
                }
            }
            if(opentype==1){
                //如果链接为空，不转换成a标签了
                if("".equals(hreflink)){
                    //   returnStr = "<a title='"+titleStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+modedataid+"\")>"+returnStr+"</a> ";
                }else{
                    if(hreflink.indexOf("/workflow/request/ViewRequest.jsp")!=-1){
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href='javascript:modeopenFullWindowHaveBarForWFList(\""+hreflink+"\",\""+requestid+"\",\""+modedataid+"\");"+removeStatusIconForMode+"'>"+returnStr+urlEnd;
                    }else{
                        if(hreflink.indexOf("?")>-1){
                            hreflink +="&is_customized_link=true";
                        }else{
                            hreflink +="?is_customized_link=true";
                        }
                        if(istitle.equals("1")){
                            if("<a ".equals(urlStart))
                                returnStr = urlStart+className+" title='"+tempreturnStr+"' href=javascript:cubeOpenFullWindowBySelf(\""+hreflink+"\")>"+returnStr+urlEnd;
                            else //("<div ".equals(urlStart))
                                returnStr = urlStart+className+" title='"+tempreturnStr+"' href=javascript:void(0) onclick='javascript:cubeOpenFullWindowBySelf(\""+hreflink+"\")'>"+returnStr+urlEnd;
                        }else{
                            returnStr = urlStart+className+" title='"+tempreturnStr+"' href=javascript:openFullWindowBySelf(\""+hreflink+"\")>"+returnStr+urlEnd;
                        }
                    }
                }
            }else if(opentype==0){
                if("".equals(hreflink)){
                    //     returnStr = "<a title='"+titleStr+"' href=javascript:void(0) onclick=javascript:window.open(\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\")>"+returnStr+"</a> ";
                }else{
                    if(hreflink.startsWith("javascript") || hreflink.indexOf("(")!=-1){
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href=\""+hreflink+"\")>"+returnStr+"</div> ";
                    }else if(hreflink.indexOf("/workflow/request/ViewRequest.jsp")!=-1){
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href=javascript:void(0) onclick='javascript:cubeOpenHref(\""+hreflink+"\",\""+requestid+"\");"+removeStatusIconForMode+"'>"+returnStr+urlEnd;
                    }else{
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href=javascript:void(0) onclick='javascript:cubeOpenHref(\""+hreflink+"\");"+removeStatusIconForMode+"'>"+returnStr+urlEnd;
                    }

                }
            }else{
                String params = viewtype+"++"+formmodeid+"++"+formID+modedataid+"++"+Util.null2String(opentype)+"++"+Util.null2String(customid)+"++"+Util.null2String(viewfrom)+"++"+Util.null2String(this.rc.getWorkcode(""+userid));
                String sliderPercentagesql = "select t.sliderpercentage from mode_customsearch t where id="+customid;
                rs.executeSql(sliderPercentagesql);
                if(rs.next()){
                    sliderPercentage =   Util.null2String(rs.getString("sliderpercentage"),"70");
                }
                if("".equals(hreflink)){
                    //returnStr = "<a title='"+titleStr+"' href=javascript:openSlideModal(\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+sliderPercentage+"\")>"+returnStr+"</a> ";
                    //returnStr = "<a title='"+titleStr+"' href=javascript:openSlideModal(\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+sliderPercentage+"\")>"+returnStr+"</a> ";
                    //returnStr = "<a title='"+titleStr+"' href='javascript:void(0)' onclick='openSlideModal(true,\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+sliderPercentage+"\");event.stopPropagation();'>"+returnStr+"</a> ";
                }else{
                    if(hreflink.indexOf("/workflow/request/ViewRequest.jsp")!=-1){
                        //returnStr = "<a title='"+titleStr+"' href=javascript:openSlideModal(\""+hreflink+"\",\""+sliderPercentage+"\")>"+returnStr+"</a> ";
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href='javascript:void(0)' onclick='openSlideModal(true,\""+hreflink+"\",\""+sliderPercentage+"\");"+removeStatusIconForMode+"event.stopPropagation();'>"+returnStr+urlEnd;
                    }else{
                        //returnStr = "<a title='"+titleStr+"' href=javascript:openSlideModal(\""+hreflink+"\",\""+sliderPercentage+"\")>"+returnStr+"</a> ";
                        returnStr = urlStart+className+" title='"+tempreturnStr+"' href='javascript:void(0)' onclick='openSlideModal(true,\""+hreflink+"\",\""+sliderPercentage+"\");"+removeStatusIconForMode+"event.stopPropagation();'>"+returnStr+urlEnd;
                    }

                }
            }

                        }

        if(!isVirtualForm){// 虚拟表单查询，目前发现标签字段，为空，返回了 下面这个div,前端重新渲染列，json报错，查询空白。
            //锁定列特殊处理，用于撑起未锁定列高度的，后续云商店解决了组件问题之后可删除，多行文本和check类型需要排除
            if(StringHelper.isEmpty(returnStr) && !fieldhtmltype.equals("2") && !fieldhtmltype.equals("4")){
                returnStr = "<div class='empty-columns' style=\"min-width:20px;min-height:20px\"></div>";
            }
        }
        //!istitle.equals("0")
        if((!"0".equals(istitle)) && !StringHelper.isEmpty(istitle) && topColumnValue==1 && !isVirtualForm ){
                    if(!"".equals(fieldvalue)){
                        returnStr+= tophtmlWithMarginString;
                    }else {
                        returnStr+=tophtmlWithOutMarginString;
                    }
        }
        return returnStr;
    }



    /**
     * 查询列表操作按钮(直接显示在列表上)判断
     */
    public Map<String,String> getSearchShowListOperation(String sourceid, String para){
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        UserManager userManager = new UserManager();
        Map<String,String> result = new HashMap<String,String>();
        String[] paras = Util.splitString(para, "+");
        if (paras.length == 0) return result;
        String customid = StringHelper.null2String(paras[0]);
        String uid = StringHelper.null2String(paras[1]);
        String modeid = StringHelper.null2String(paras[2]);
        String formid = Util.null2String(paras[3]);
        String istree = "";
        if(paras.length==5){
            istree = paras[4];
        }
        int userid = Util.getIntValue(uid, 0);
        int modeidInt = Util.getIntValue(modeid, 0);
        User user = userManager.getUserByUserIdAndLoginType(userid, "1");
        //这里只校验展示的列表上的自定义按钮
        String expandSql ="select id,buttonname,hreftype,interfacePath,pageexpandid from mode_customSearchButton where objid=? and isshow=1  and isshowlist=1 order by showorder asc,id desc";
        if("istree".equals(istree)){
            expandSql ="select id,buttonname,hreftype,interfacePath,pageexpandid from mode_customSearchButton where objid=? and isshow=1 order by showorder asc,id desc";
        }
        RecordSet.executeQuery(expandSql,customid);
        while (RecordSet.next()) {
            String id = Util.null2String(RecordSet.getString("id"));
            String buttonname = Util.null2String(RecordSet.getString("buttonname"));
            String hreftype = Util.null2String(RecordSet.getString("hreftype"));
            String classpath = Util.null2String(RecordSet.getString("interfacePath"));
            String showButton = "false";
            if("1".equals(hreftype)){
                if (!StringHelper.isEmpty(classpath)) {
                    try {
                        object = (PopedomCommonAction)Class.forName(classpath).newInstance();
                        showButton = object.getIsDisplayOperation(modeid,customid,uid,sourceid,buttonname);
                    } catch (Exception e) {
                        showButton = "true";
                    }
                } else {
                    showButton = "true";
                }
            }else if("2".equals(hreftype)){
                showButton = "true";
            }else if("3".equals(hreftype)){
                if(modeidInt > 0){
                    int pageExpandId = Util.getIntValue(RecordSet.getString("pageexpandid"), 0);
                    String sql = "select issystem,issystemflag from mode_pageexpand where id = " + pageExpandId + " and isbatch = 0 and (issystem = 1 or (issystem = 0 and viewpage = 1)) and modeid = " + modeidInt;
                    rs.executeSql(sql);
                    if(rs.next()){
                    	int issystem = Util.getIntValue(rs.getString("issystem"), 0);
                        int issystemflag = Util.getIntValue(rs.getString("issystemflag"),0);
                        ExpandBaseRightInfo expandBaseRightInfo = new ExpandBaseRightInfo();
                        expandBaseRightInfo.setUser(user);
                        boolean hasRightOfPageExpand = expandBaseRightInfo.checkExpandRight(String.valueOf(pageExpandId), modeid, sourceid);
                        if(hasRightOfPageExpand){
                            if (issystem==1&&(issystemflag==3||issystemflag == 4)) {//需要进行编辑权限判断
                            	boolean haveEdit = this.haveRight(formid, user, modeidInt, sourceid, "edit");
                            	if (haveEdit) {
                            		showButton = "true";
								}
							}else if (issystem==1&&issystemflag == 5) {//需要进行删除权限判断
								boolean haveDel = this.haveRight(formid, user, modeidInt, sourceid, "del");
                            	if (haveDel) {
                            		showButton = "true";
								}
							}else {//不需要进行权限判断
								showButton = "true";
							}
                        }
                    }
                }
            }else if("5".equals(hreftype) || "6".equals(hreftype)){
            	showButton = "true";
            }
            result.put(id,showButton);
        }
        return result;
    }


    public String getOperates (String fieldvalue,String paraTwo) {
        JSONArray array = new JSONArray();
        String[] paras = Util.splitString(paraTwo, "+");
        if (paras.length == 0) return array.toString();

        String sourceid =  StringHelper.null2String(paras[0]);
        String customid = StringHelper.null2String(paras[1]);
        String uid = StringHelper.null2String(paras[2]);
        String modeid = StringHelper.null2String(paras[3]);
        String formid = Util.null2String(paras[4]);

        User user = new User();
        int userid = Util.getIntValue(uid, 0);
        user.setUid(userid);
        String istree = "";
        if(paras.length==6){
            istree = paras[5];
        }
        String parm = "";
        if("istree".equals(istree)){
            parm = customid+"+"+uid+"+"+modeid+"+"+formid+"+"+istree;
        }else{
            parm = customid+"+"+uid+"+"+modeid+"+"+formid;
        }
        Map<String,String> showMap= getSearchShowListOperation(sourceid,parm);
        if(showMap.isEmpty()) return  array.toString();
        RecordSet rs = new RecordSet();
        String sql="select  * from mode_customSearchButton  where objid=? and isshow=1 and isshowlist=1 order by showorder asc,id desc";
        if("istree".equals(istree)){
            sql="select  * from mode_customSearchButton  where objid=? and isshow=1 order by showorder asc,id desc";
        }
        rs.executeQuery(sql,customid);
        int index=0;
        int num =0;
        CubeSearchService cubeSearchService =new CubeSearchService();
        Map<String,String> expenParam = new HashMap<>();
        Map<String,Object> params = new HashMap<>();
        while(rs.next()){
            String id = Util.null2String(rs.getString("id"));
            num++;
            boolean isshow= "".equals(Util.null2String(showMap.get(id)))||"false".equals(Util.null2String(showMap.get(id)));
            if( isshow ) continue;
            int pageExpandId = Util.getIntValue(rs.getString("pageexpandid"),0);


            //拼接提示内容 start

            String sqlForExpand = "select a.id, a.expendname, a.showtype, a.opentype, a.hreftype," +
                    "            a.hrefid, a.hreftarget, a.showorder, a.issystem, a.groupid," +
                    "            a.showorder,a.defaultselect,a.isenabletip,a.tiptype,"+
                    "            a.tipdatasourceid,a.tipsql,a.tipjk " +
                    "       from mode_pageexpand a " +
                    " where a.id = ?"+
                    "   order by a.showorder asc,a.id desc ";
            RecordSet rsForExpand = new RecordSet();
            rsForExpand.executeQuery(sqlForExpand,pageExpandId);

            while(rsForExpand.next()){
                //获取页面扩展括号内的内容
                //1、封装相关参数
                expenParam.put("isenabletip",Util.null2String(rsForExpand.getString("isenabletip")));
                expenParam.put("tiptype",Util.null2String(rsForExpand.getString("tiptype")));
                expenParam.put("tipdatasourceid",Util.null2String(rsForExpand.getString("tipdatasourceid")));
                expenParam.put("tipsql",Util.null2String(rsForExpand.getString("tipsql")));
                expenParam.put("tipjk",Util.null2String(rsForExpand.getString("tipjk")));
            }
            //2、获取相关拼接内容#800358
            params.put("formId",formid);
            params.put("billid","1");//用列表查询 指定列表中的第一个数据，用户提示需求#819808
            String expendContext = PageExpandUtil.getExpendContext(expenParam,user,params);
            if(pageExpandId==0){
                expendContext = "";
            }
            //拼接提示内容 end
            String buttonName = Util.null2String(rs.getString("buttonname"))+expendContext;
            String hreftype = Util.null2String(rs.getString("hreftype"));
            String hreftargetParid = Util.null2String(rs.getString("hreftargetParid"));
            String hreftargetParval = Util.null2String(rs.getString("hreftargetParval"));
            String hreftarget = Util.null2String(rs.getString("hreftarget"));
            String jsmethodname = Util.null2String(rs.getString("jsmethodname"));
            String jsParameter = Util.null2String(rs.getString("jsParameter"));
            String jsmethodbody = Util.null2String(rs.getString("jsmethodbody"));
            String icon = Util.null2String(rs.getString("icon"));
            Operate operate = new Operate();
            operate.setIndex(""+index);
            operate.setText(buttonName);
            operate.setIcon(icon);
            if("1".equals(hreftype)){
                if(!StringHelper.isEmpty(jsParameter)){
                    StringBuffer fieldBuf = new StringBuffer();
                    ArrayList<String> fieldList = Util.TokenizerString(jsParameter, ",");
                    for(int fieldIdx=0; fieldIdx<fieldList.size(); fieldIdx++){
                        if(!StringHelper.isEmpty(fieldList.get(fieldIdx))){
                            fieldBuf.append("column:"+fieldList.get(fieldIdx)+"+");
                        }
                    }
                    if(!StringHelper.isEmpty(fieldBuf.toString())){
                        jsParameter = fieldBuf.substring(0,fieldBuf.length()-1);
                    }
                    operate.setOtherpara(jsParameter);
                }
                Pattern pat = Pattern.compile("javascript\\s*:");
                if (!pat.matcher(jsmethodname).find()) {//错误格式添加上javascript:防止查询列表报错
                    jsmethodname="javascript:"+jsmethodname;
                }
                operate.setHref(jsmethodname);
            }else if("2".equals(hreftype)){
                if(!StringHelper.isEmpty(hreftargetParval)){
                    StringBuffer fieldBuf = new StringBuffer();
                    ArrayList<String> fieldList = Util.TokenizerString(hreftargetParval, ",");
                    for(int fieldIdx=0; fieldIdx<fieldList.size(); fieldIdx++){
                        if(!StringHelper.isEmpty(fieldList.get(fieldIdx))){
                            fieldBuf.append("column:"+fieldList.get(fieldIdx)+"+");
                        }
                    }
                    if(!StringHelper.isEmpty(fieldBuf.toString())){
                        jsParameter = fieldBuf.substring(0,fieldBuf.length()-1);
                    }
                    operate.setOtherpara(jsParameter);
                }

                String _blank = "_blank";
                if("2".equals(Util.null2String(rs.getString("hreftargetOpenWay"))))
                    _blank = "_fullwindow";
                hreftarget=hreftarget.replaceAll("&","&amp;");  //避免&符号在xml解析是报错
                operate.setHref("javascript:modeOpenUrl('"+hreftarget+"','"+_blank+"')");
                operate.setIsalwaysshow("true");
                operate.setLinkkey(hreftargetParid);
                operate.setLinkvaluecolumn(hreftargetParval);
            }else if("3".equals(hreftype)){
                String jsAction = cubeSearchService.analyzePageExpandJsAction(pageExpandId);
                if("".equals(jsAction)){
                    jsAction = "void(0)";
                }
                operate.setHref("javascript:"+jsAction);
            }else if(("5".equals(hreftype) || "6".equals(hreftype)) && Util.getIntValue(modeid,-1)>0){
                String likesinfo = analyzeLikesButton(sourceid,modeid+"+"+uid);
                operate.setOtherpara("#islikebutton:1+#likeinfo:"+hreftype+","+likesinfo);
            }
            array.add(operate);
            index++;
        }
        return array.toString();
    }
    
    public String analyzeLikesButton(String topicid,String para) {
    	String likesinfo = "";
    	JSONArray array = new JSONArray();
        String[] paras = Util.splitString(para, "+");
        if (paras.length == 0) return array.toString();
        String modeid =  StringHelper.null2String(paras[0]);
        String userid = StringHelper.null2String(paras[1]);
    	RecordSet rs = new RecordSet();
    	//赞
    		int likecount = 0;
    		rs.executeQuery("select count(1) as likecount from uf_likes where modeid=? and topicid=? and status=1", modeid,topicid);
    		if(rs.next()){
    			likecount = Util.getIntValue(rs.getString("likecount"), 0);
    		}
    		likesinfo += likecount;
    		int dislikecount = 0;
    		rs.executeQuery("select count(1) as dislikecount from uf_likes where modeid=? and topicid=? and status=2", modeid,topicid);
    		if(rs.next()){
    			dislikecount = Util.getIntValue(rs.getString("dislikecount"), 0);
    		}
    		likesinfo += ","+dislikecount;
    		String status = "";
    		rs.executeQuery("select status from uf_likes where modeid=? and topicid=? and userid=?", modeid,topicid,userid);
    		if(rs.next()){
    			status = Util.null2String(rs.getString("status"));
    		}
    		likesinfo += ","+status;
    	return likesinfo;
	}


	public String getFileHTMLStr(String fieldvalue, String modedataid,
			String fieldid, String fieldtype, int userlanguage, String formmodeid, String formID, String viewtype,
			String norightlist, int customid) throws Exception {
		String returnStr="";
		String docs = "";
		String attachids = "";
		String notEncryptAttachids = "";// 不加密
        String attachnames = "";
		int count =0;
		long sumkb = 0;
		RecordSet rs= new RecordSet();
		RecordSet RecordSet= new RecordSet();
		String dbType = RecordSet.getDBType();
		String docids = FormmodeUtil.delEmptyImageId(fieldvalue);
		if("mysql".equals(dbType.toLowerCase())){
		    RecordSet.execute("select id,docsubject,accessorycount,SecCategory,doccreaterid,doccreatedate,doccreatetime from docdetail where id in("+docids+") order by SUBSTRING_INDEX(',"+docids+",',id,1)");
		}else if("sqlserver".equals(dbType.toLowerCase())){
		    RecordSet.execute("select id,docsubject,accessorycount,SecCategory,doccreaterid,doccreatedate,doccreatetime from docdetail where id in("+docids+") order by charindex(','+ convert(varchar,id)+',', ',"+docids+",')");
		}else if("postgresql".equals(dbType.toLowerCase())){
			// pg 数据库不支持SUBSTRING_INDEX 没有兼容的方法， 去掉order 
            RecordSet.execute("select id,docsubject,accessorycount,SecCategory,doccreaterid,doccreatedate,doccreatetime from docdetail where id in("+docids+")  ");
        }else{
		    RecordSet.execute("select id,docsubject,accessorycount,SecCategory,doccreaterid,doccreatedate,doccreatetime from docdetail where id in("+docids+") order by instr('"+docids+"',id)");
		}
		int linknum=-1;
		int singleValue=0;
		int moreValue=0;
		int thumbnail = 0;//缩略图
		int thumbnailHeight = 0;
		int thumbnailWidth = 0;

		int modeid = Util.getIntValue(formmodeid, 0);
		int formid = Util.getIntValue(formID, 0);
		String empowmentType = "";
		rs.executeQuery("select empowmentType from modeinfo where id ="+modeid+" and formid="+formid);
		if(rs.next()){
		    empowmentType= rs.getString("empowmentType");
		}
		if(empowmentType.contains(",")){
		    empowmentType = empowmentType.split(",")[0];
		}
        String datashowtype = customSearchComInfo.getDatashowtype(""+customid);
		String authorizeparam="&formmode_authorize=formmode_authorize&moduleid=formmode&authorizemodeId="+formmodeid+"&authorizefieldid="+fieldid
		        +"&authorizeformmodebillId="+modedataid;
		rs.executeSql("select singlevalue,morevalue,thumbnail,thumbnailHeight,thumbnailWidth from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
		while(rs.next()){
		    singleValue = rs.getInt("singlevalue");
		    moreValue = rs.getInt("morevalue");
		    thumbnail = rs.getInt("thumbnail");
		    thumbnailHeight = rs.getInt("thumbnailHeight");
		    thumbnailWidth = rs.getInt("thumbnailWidth");

		}
		int thumbnailSingleDownload = 0;
		int thumbnailBatchDownload = 0;
		String thumbnailImgHTML="";
        String datashowtypeHTML="";
        DocDownloadCheckUtil docDownloadCheckUtil = new DocDownloadCheckUtil();
        List list =new ArrayList();//存储文档,文档可能会被删除,批量下载需要判断
		while(RecordSet.next()){
            linknum++;
            if(linknum>0) returnStr+="<br>";
            String showid = Util.null2String(RecordSet.getString(1)) ;
            String tempshowname= Util.toScreen(RecordSet.getString(2),userlanguage) ;
            int accessoryCount=RecordSet.getInt(3);

            DocImageManager.resetParameter();
            DocImageManager.setDocid(Integer.parseInt(showid));
            DocImageManager.selectDocImageInfo();

            String docImagefileid = "";
            String notEncryptDocImagefileid ="";
            long docImagefileSize = 0;
            String docImagefilename = "";
            String fileExtendName = "";
            int versionId = 0;
            if(DocImageManager.next()){
                docImagefileid = DocImageManager.getImagefileid();
                notEncryptDocImagefileid = DocImageManager.getImagefileid();
                docImagefileid = docDownloadCheckUtil.checkPermission(docImagefileid, null);
                docImagefileSize = DocImageManager.getImageFileSize(Util.getIntValue(docImagefileid));
                docImagefilename = DocImageManager.getImagefilename();
                fileExtendName = docImagefilename.substring(docImagefilename.lastIndexOf(".")+1).toLowerCase();
                versionId = DocImageManager.getVersionId();
                list.add(docImagefilename);
            }
            docs+=showid+",";
            count ++;
            attachids+=docImagefileid+",";
            attachnames+=docImagefilename+",";
            notEncryptAttachids+=notEncryptDocImagefileid+",";
            if(thumbnail==1&&fieldtype.equals("2")){
                //returnStr += "<img src=\"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&requestid=\" height=\""+thumbnailHeight+"\" width=\""+thumbnailWidth+"\"  >";
                if("0".equals(empowmentType)) {//临时赋权
                    thumbnailImgHTML += "<div class=\"cube-list-img-four\"><img class='cubeFormImgPlay'" +
                            " data-imgsrc=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+authorizeparam+"&requestid=\""+
                            " src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+authorizeparam+"&requestid=\"></img></div>";
                }else{
                    thumbnailImgHTML += "<div class=\"cube-list-img-four\"><img class='cubeFormImgPlay'" +
                            " data-imgsrc=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&requestid=\""+
                            " src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&requestid=\"></img></div>";
                }
            }else {
                if (accessoryCount == 1 && (fileExtendName.equalsIgnoreCase("xls") || fileExtendName.equalsIgnoreCase("doc") || fileExtendName.equalsIgnoreCase("pdf")
                        || fileExtendName.equalsIgnoreCase("xlsx") || fileExtendName.equalsIgnoreCase("docx")
                )) {
                    if("0".equals(empowmentType)){//临时赋权
                        returnStr += "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index2file.jsp?id=" + showid + authorizeparam + "&imagefileId=" + docImagefileid + "&isFromAccessory=true\")>" + docImagefilename + "</a> ";
                    }else{
                        returnStr += "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index2file.jsp?id=" + showid + "&imagefileId=" + docImagefileid + "&isFromAccessory=true\")>" + docImagefilename + "</a> ";
                    }
                } else {
                    if("0".equals(empowmentType)){
                        returnStr += "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index.jsp?id=" + showid + authorizeparam + "\")>" + tempshowname + "</a> ";
                    }else{
                        returnStr += "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index.jsp?id=" + showid + "\")>" + tempshowname + "</a> ";
                    }
                }
            }
            if ("1".equals(datashowtype) && StringHelper.isEmpty(datashowtypeHTML) && fieldtype.equals("2")){
                if("0".equals(empowmentType)){//临时赋权
                    datashowtypeHTML = weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+authorizeparam;
                }else{
                    datashowtypeHTML = weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid;
                }
            }
            if(singleValue==1  && !"1".equals(norightlist)){
                if("0".equals(empowmentType)) {//临时赋权
                    returnStr+="<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&download=1"+authorizeparam+"&requestid='\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/down_wev8.png\"></a> ";
                }else{
                    returnStr+="<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&download=1&requestid='\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/down_wev8.png\"></a> ";
                }
                sumkb += docImagefileSize;
            }
        }

		if(moreValue==1 && !"1".equals(norightlist)&&list.size()>0) {
            if("0".equals(empowmentType)) {//临时赋权
                returnStr += "<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fieldvalue=" + docs + "&delImgIds=" +notEncryptAttachids+ "&download=1&downloadBatch=1"+authorizeparam+"&requestid='\" class=\"alldown\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/alldown_wev8.png\"></a> ";
            }else{
                returnStr += "<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fieldvalue=" + docs + "&delImgIds=" +notEncryptAttachids+ "&download=1&downloadBatch=1&requestid='\" class=\"alldown\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/alldown_wev8.png\"></a> ";
            }

		}

		if(thumbnail==1){
		    if(linknum>-1) {
		        if(moreValue==1){
		            thumbnailBatchDownload = 1;
		        }
		        if(singleValue==1) {
		            thumbnailSingleDownload = 1;
		        }
		        if(linknum==0){
		            thumbnailImgHTML = thumbnailImgHTML.replaceAll("cube-list-img-four","cube-list-img-one");
		        }else if(linknum==1){
		            thumbnailImgHTML = thumbnailImgHTML.replaceAll("cube-list-img-four","cube-list-img-two");
		        }else if(linknum==2){
		            thumbnailImgHTML = thumbnailImgHTML.replaceAll("cube-list-img-four","cube-list-img-three");
		        }
                if(attachids.endsWith(",")){
                    attachids = attachids.substring(0,attachids.length()-1);
                    docs = docs.substring(0,docs.length()-1);
                }
		        String showThumbnailHTML = "<div  class=\"cube-list-img-div\">";
		        if(!"0".equals(empowmentType)) {//不是临时赋权
		            authorizeparam="&requestid=";
		        }else{
		            authorizeparam+="&requestid=";
		        }
		        showThumbnailHTML += "<div onClick=\"cubeshowDdImg('" + attachids + "','" + thumbnailHeight + "','" + thumbnailWidth + "','" + thumbnailBatchDownload + "','" + thumbnailSingleDownload + "','"+docs+"','"+authorizeparam+"')\" class=\"cube-list-img-container\">";
		        showThumbnailHTML += thumbnailImgHTML;
		        showThumbnailHTML += "</div>";
		        if(thumbnailBatchDownload==1 && !"1".equals(norightlist)) {
		            showThumbnailHTML += "<div " +
		                    //"onclick=\"window.open('/weaver/weaver.file.FileDownload?delImgIds="+attachids+"&download=1&downloadBatch=1&requestid=&fieldvalue="+docs+"','_self')\""+
		                    " class=\"cube-list-img-download\" " +
		                    " thumbnailSingleDownload=\"" + thumbnailSingleDownload + "\" thumbnailBatchDownload=\"" + thumbnailBatchDownload + "\" >" +
		                   //"   <span class=\"icon-coms-download\"></span>" +
		                    //"<img src=\"/formmode/images/alldown_wev8.png\"></img>"+
		                    "<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fieldvalue=" + docs + "&delImgIds=" + notEncryptAttachids + "&download=1&downloadBatch=1"+authorizeparam+"'\" class=\"alldown\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/alldown_wev8.png\"></a> "+
		                    "</div>";
		        }
		        showThumbnailHTML += "</div>";
		        showThumbnailHTML += "</div>";
		        returnStr = showThumbnailHTML;
		    }else{
		        returnStr = "";
		    }
		}
        if ("1".equals(datashowtype) ){
            if(fieldtype.equals("2")){
                returnStr = datashowtypeHTML +"|||"+ returnStr;
            }else{
                if(attachnames.endsWith(",")){
                    attachnames = attachnames.substring(0,attachnames.length()-1);
                }
                attachnames = Util.StringReplace(attachnames,"&amp;", "&");
                returnStr = attachnames +"|||"+returnStr;
            }

        }
		return returnStr;
	}

    /**
     * 获得自定义显示字段的显示内容，不做标题字段
     * @param paraTwo  字段ID+"+"+字段类型+"+"+字段类型+"+"+显示语言
     * @return 显示内容
     */
    public String getOthersNoTitle (String fieldvalue,String paraTwo) {
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        String sql = "";
        boolean isshowmethod = false;
        if(paraTwo.indexOf("noshowmethod")>-1){
            isshowmethod = true;
            paraTwo = paraTwo.replace("+noshowmethod", "");
        }
        String[] tempStr = Util.TokenizerString2(paraTwo, "+");
        String modedataid = Util.null2String(tempStr[0]);
        int pcount = tempStr.length-17;//添加处理虚拟表单主键字段含有加号的逻辑，
        if(pcount>0){
            modedataid = "";
            for (int i = 0; i < pcount+1; i++) {
                modedataid += "+"+tempStr[i];
            }
            modedataid = modedataid.substring(1);
        }else{
            pcount=0;
        }
        String fieldid = Util.null2String(tempStr[1+pcount]);
        String fieldhtmltype = Util.null2String(tempStr[2+pcount]);
        String fieldtype = Util.null2String(tempStr[3+pcount]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4+pcount]));
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5+pcount]);
        String dbtype = Util.null2String(tempStr[6+pcount]);
        int qfws = Util.getIntValue(tempStr[7+pcount]);
        String formmodeid = Util.null2String(tempStr[8+pcount]);
        String formID = Util.null2String(tempStr[9+pcount]);
        String viewtype = Util.null2String(tempStr[10+pcount]);
        boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formID);
        String norightlist = "";
        /**无权限列表处理*/
        if(tempStr.length>=13){
            CustomSearchService customSearchService=new CustomSearchService();
            String repordid = Util.null2String(tempStr[12+pcount]);
            Map<String,Object> map=customSearchService.getCustomSearchById(Util.getIntValue(repordid,0));
            if(map.size()>0){
                norightlist=Util.null2String(map.get("norightlist"));
            }
        }
        String vdatasource = "";
        if(isVirtualForm){
            Map<String,Object> vFormInfo = VirtualFormHandler.getVFormInfo(formID);
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
        }
        int opentype = 0;
        int customid = 0;
        String showmethod = "";
        int userid = 0;
        int enabled = -1;
        boolean isenabled = false;
        String viewfrom = "";//来源
        RecordSet recordSet = new RecordSet();
        if(formmodeid.equals("0")){
            //String sqlStr = "select formmodeid from formtable_main_"+formID.replace("-", "")+" where id="+modedataid;
            String tablename = "";
            String sqlStr = "select tablename from workflow_bill where id="+formID;
            RecordSet.executeSql(sqlStr);
            if (RecordSet.next()) {
                tablename = Util.null2String(RecordSet.getString("tablename"));
            }
            if(isVirtualForm){
                tablename = VirtualFormHandler.getRealFromName(tablename);
            }
            if (!StringHelper.isEmpty(tablename)) {
                sqlStr = "select formmodeid from "+tablename+" where id="+modedataid;
                RecordSet.executeSql(sqlStr);
                if(RecordSet.next()){
                    formmodeid = RecordSet.getString("formmodeid");
                }
            }
        }else if(formmodeid.equals("virtual")){
            formmodeid = "0";
        }
        if(tempStr.length>13){
            opentype = Util.getIntValue(tempStr[11+pcount],0);
            customid = Util.getIntValue(tempStr[12+pcount],0);
            viewfrom = Util.null2String(tempStr[13+pcount]);
        }
        if(tempStr.length>14){
            showmethod = Util.null2String(tempStr[14+pcount]);
        }

        isenabled = customSearchComInfo.getEnabled(customid+"");
        if(tempStr.length>15){
            userid = Util.getIntValue(tempStr[15+pcount]);
            enabled = Util.getIntValue(tempStr[16+pcount]);
        }

        if(isshowmethod){
            showmethod = "0";
        }

        try{
            if (fieldtype.equals("118")) {
                returnStr="<a href=\""+weaver.general.GCONST.getContextPath()+"/meeting/report/MeetingRoomPlan.jsp\" target=\"_blank\">"+SystemEnv.getHtmlLabelName(2193,userlanguage)+"</a>";
            }
            if(fieldhtmltype.equals("1")){  // 单行

                if(fieldhtmltype.equals("1") && fieldtype.equals("4")){
                    returnStr = Util.toDecimalDigits(fieldvalue,2);
                }else if(fieldtype.equals("3")||fieldtype.equals("5")){
                    int decimaldigits_t=2;
                    if(fieldtype.equals("3") && dbtype.indexOf(",") > -1){
                        decimaldigits_t = Util.getIntValue(dbtype.substring(dbtype.indexOf(",") + 1, dbtype.length() -1 ), 2);
                    }
                    if (fieldtype.equals("5")) {//千分位保留几位小数以qfws为准
                        String [] arr = paraTwo.split("\\+");
                        if(qfws==2 && paraTwo.indexOf("'") == -1 && arr.length<19){//如果参数中没指定小数，则以实际值为准
                            try{
                                int qfwsTrue = fieldvalue.split("\\.")[1].length();
                                decimaldigits_t = qfwsTrue>0 && qfwsTrue<=4 ? qfwsTrue:qfws;
                            }catch (Exception e){
                            }
                        }else{
                            decimaldigits_t=qfws;
                        }
                    }
                    fieldvalue=fieldvalue.replaceAll(",","");//金额千分位先去掉,方便下面的保留小数
                    if(!"".equals(fieldvalue)){
                        BigDecimal b=new BigDecimal(fieldvalue);
                        b.setScale(decimaldigits_t,BigDecimal.ROUND_HALF_UP);
                        returnStr = Util.toDecimalDigits(b.toPlainString(), decimaldigits_t);
                        //如果是千分位
                        returnStr = fieldtype.equals("5")?changeToThousands(returnStr):returnStr;
                        fieldvalue = returnStr;
                    }
                }else{
                    returnStr=Util.toHtmlSearch(fieldvalue);
                }
            }else if(fieldhtmltype.equals("2")){//多行文本框
                fieldvalue = Util.null2String(fieldvalue);
                String tempString=fieldvalue;
                tempString = tempString.replaceAll("<p>","<br/>");
                tempString = tempString.replaceAll("</p>","<br/>");
                tempString = tempString.replaceAll("<script>initFlashVideo();</script>","");
                tempString = tempString.replaceAll("<br>","</br></span><span>");
                //tempString = tempString.replaceAll("<br>","");
                String reg="[\u0000-\u001f|\ufffd|囧|]";
                try {
                    //tempString = Util.replace(tempString,reg,"",0);
                } catch (Exception e) {

                }
                returnStr = "<span>"+tempString+"</span>";
            }                                                          // 单行,多行文本框条件结束
            else if(fieldhtmltype.equals("3")){                         // 浏览按钮 (涉及workflow_broswerurl表)
                if(fieldtype.equals("2") || fieldtype.equals("19")){    // 日期和时间
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("290")){// 日期时间
                    returnStr="".equals(Util.null2String(fieldvalue))?"":new DateTransformer().getLocaleDateTime(fieldvalue);  
                } else if(fieldtype.equals("402") || fieldtype.equals("403")){    // 日期和时间
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("224")||fieldtype.equals("225") ||fieldtype.equals("226")||fieldtype.equals("227")){
                    returnStr=fieldvalue;
                } else if(!fieldvalue.equals("")) {
                    String linkurl=getBrowserLinkurl(fieldtype);    // 浏览值点击的时候链接的url
                    String showname = "";                                                   // 值显示的名称
                    String showid = "";                                                     // 值

                    ArrayList tempshowidlist=Util.TokenizerString(fieldvalue,",");
                    if(fieldtype.equals("8") || fieldtype.equals("135")){
                        //项目，多项目
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("1") ||fieldtype.equals("17")||fieldtype.equals("165") ||fieldtype.equals("166")){
                        //人员，多人员
                        for(int k=0;k<tempshowidlist.size();k++){
                        	showname+="<a href=javaScript:openhrm("+tempshowidlist.get(k)+") onclick=pointerXY(event)>"+rc.getResourcename((String)tempshowidlist.get(k))+"</a>&nbsp;";
                        }
                    }else if(fieldtype.equals("7") || fieldtype.equals("18")){
                        //客户，多客户
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+cci.getCustomerInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=cci.getCustomerInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("4") || fieldtype.equals("57")|| fieldtype.equals("167")|| fieldtype.equals("168")){
                        orgShowBiz = new OrganizationShowSetBiz();
                        String sepCharacter = orgShowBiz.getSepCharacter();
                        //部门，多部门
                        for(int k=0;k<tempshowidlist.size();k++){
                            String departmentShow = orgShowBiz.getDepartmentShow("model", (String)tempshowidlist.get(k));
                            if(sepCharacter.equals(departmentShow)){
                                departmentShow = "";
                            }
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+departmentShow+"</a>&nbsp;";
                            }else{
                                if(!departmentShow.equals("")) {
                                    showname += departmentShow + " ";
                                }
                            }
                        }
                    }else if(fieldtype.equals("9") || fieldtype.equals("37")){
                        //文档，多文档
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";

                            {
                                if(!linkurl.equals("")){
                                    showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"&modedataid="+modedataid+"\" target=\"_new\">"+DocComInfo1.getDocname((String)tempshowidlist.get(k))+"</a>";
                                }else{
                                    showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k));
                                }
                            }
                        }
                    }else if(fieldtype.equals("23")){
                        //资产
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("16") || fieldtype.equals("152")|| fieldtype.equals("171")){
                        //相关请求
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";
                            if(!linkurl.equals("")){
                                int tempnum=0;
                                tempnum++;

                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"&wflinkno="+tempnum+"\" target=\"_new\">"+WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+"</a>";
                            }else{
                                showname+=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k));
                            }
                        }
                    }else if(fieldtype.equals("141")){
                        //人力资源条件
                        showname+=rcm.getFormShowName(fieldvalue,userlanguage);
                    }
                    //added by alan for td:10814
                    else if(fieldtype.equals("142")) {
                        //收发文单位
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                                showname += "<a href='"+linkurl+tempshowidlist.get(k)+"' target='_new'>"+ duc.getReceiveUnitName(""+tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname += duc.getReceiveUnitName(""+tempshowidlist.get(k))+" ";
                            }
                        }
                    }
                    else if(fieldtype.equals("161")){//自定义单选
                        showname = "";                                   // 新建时候默认值显示的名称
                        String showdesc="";
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, showid,null);
                            String desc=Util.null2String(bb.getDescription());
                            String name=Util.null2String(bb.getName());
                            if(isAutoDecrypt){
                                name = EncryptConfigBiz.getDecryptData(name);
                                desc = EncryptConfigBiz.getDecryptData(desc);
                            }
//							showname="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                            String href=Util.null2String(bb.getHref());
                            if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                            	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
    						}
                            if(href.equals("")){
                                showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                            }else{
                                String tempcustomid = Util.null2String(browser.getCustomid());
                                href = new ButtonElement().getHrefByBrowser(tempcustomid, href, showid, recordSet);
                                showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    }
                    else if(fieldtype.equals("162")){//自定义多选
                        showname = "";                                   // 新建时候默认值显示的名称
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            List l=Util.TokenizerString(showid,",");
                            for(int j=0;j<l.size();j++){
                                String curid=(String)l.get(j);
                                BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, curid,null);
                                String name=Util.null2String(bb.getName());
                                ////System.out.println("showname:"+showname);
                                String desc=Util.null2String(bb.getDescription());
                                if(isAutoDecrypt){
                                    name = EncryptConfigBiz.getDecryptData(name);
                                    desc = EncryptConfigBiz.getDecryptData(desc);
                                }
                                ////System.out.println("showname:"+showname);
//							    showname+="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                                String href=Util.null2String(bb.getHref());
                                if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                                	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
        						}
                                if(href.equals("")){
                                    showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                }else{
                                    String tempcustomid = Util.null2String(browser.getCustomid());
                                    href = new ButtonElement().getHrefByBrowser(tempcustomid, href, curid, recordSet);
                                    showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                                }
                            }
                        }catch(Exception e){
                        }
                    }else if (fieldtype.equals("256")||fieldtype.equals("257")) {//自定义树形单选
                        CustomTreeUtil customTreeUtil = new CustomTreeUtil();
                        customTreeUtil.setReturnDecryptData(isAutoDecrypt);
                        showid = fieldvalue;
                        if(this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true") ){
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname");
                        }else{
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"openByTreeField");
                        }

                    }else{
                        String tablename=BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                        String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                        String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        if(fieldvalue.indexOf(",")!=-1){
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+" in( "+fieldvalue+")";
                        }
                        else {
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+"="+fieldvalue;
                        }
                        RecordSet.executeSql(sql);
                        while(RecordSet.next()){
                            if(!linkurl.equals("") ){
                                showname += "<a href=\""+linkurl+RecordSet.getString(1)+"\" target=\"_new\">"+Util.toScreen(RecordSet.getString(2),userlanguage)+"</a>&nbsp;";
                            }else{
                                showname +=Util.toScreen(RecordSet.getString(2),userlanguage)+" ";
                            }
                        }    // end of while
                    }
                    returnStr=showname;
                }
            }                                                       // 浏览按钮条件结束
            else if(fieldhtmltype.equals("4")) {                    // check框
                returnStr=fieldvalue;
            }                                                       // check框条件结束
            else if(fieldhtmltype.equals("5")){                     // 选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+isbill);
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                    String tmpselectname = Util.toScreen(rs.getString("selectname"),userlanguage);
                    List l=Util.TokenizerString(fieldvalue,",");
                    if(l.contains(tmpselectvalue)){
                        returnStr += ","+tmpselectname;
                    }
                }
                if(!returnStr.isEmpty()){
                    returnStr = returnStr.substring(1);
                }
            }else if(fieldhtmltype.equals("6")){ //文档（附件）
                if(!fieldvalue.equals("")) {
                    String docs = "";
                    String attachids = "";
                    int count =0;
                    long sumkb = 0;
                    sql="select id,docsubject,accessorycount from docdetail where id in("+fieldvalue+") order by id asc";
                    int linknum=-1;
                    RecordSet.executeSql(sql);
                    int singleValue=0;
                    int moreValue=0;
                    rs.executeSql("select singlevalue,morevalue from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
                    while(rs.next()){
                        singleValue = rs.getInt("singlevalue");
                        moreValue = rs.getInt("morevalue");
                    }
                    while(RecordSet.next()){
                        linknum++;
                        if(linknum>0) returnStr+="<br>";
                        String showid = Util.null2String(RecordSet.getString(1)) ;
                        String tempshowname= Util.toScreen(RecordSet.getString(2),userlanguage) ;
                        int accessoryCount=RecordSet.getInt(3);

                        DocImageManager.resetParameter();
                        DocImageManager.setDocid(Integer.parseInt(showid));
                        DocImageManager.selectDocImageInfo();

                        String docImagefileid = "";
                        long docImagefileSize = 0;
                        String docImagefilename = "";
                        String fileExtendName = "";
                        int versionId = 0;
                        if(DocImageManager.next()){
                            docImagefileid = DocImageManager.getImagefileid();
                            docImagefileSize = DocImageManager.getImageFileSize(Util.getIntValue(docImagefileid));
                            docImagefilename = DocImageManager.getImagefilename();
                            fileExtendName = docImagefilename.substring(docImagefilename.lastIndexOf(".")+1).toLowerCase();
                            versionId = DocImageManager.getVersionId();
                        }
                        docs+=showid+",";
                        count ++;
                        attachids+=docImagefileid+",";
                        if(accessoryCount==1 && (fileExtendName.equalsIgnoreCase("xls")||fileExtendName.equalsIgnoreCase("doc")||fileExtendName.equalsIgnoreCase("pdf")
                        		||fileExtendName.equalsIgnoreCase("xlsx")||fileExtendName.equalsIgnoreCase("docx")
                        		)){
                            returnStr+= "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index2file.jsp?id="+showid+"&imagefileId="+docImagefileid+"&isFromAccessory=true\")>"+docImagefilename+"</a> ";
                        }else{
                            returnStr+="<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index.jsp?id="+showid+"\")>"+tempshowname+"</a> ";
                        }
                        
                        if(singleValue==1  && !"1".equals(norightlist)){
                            returnStr+="<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid="+docImagefileid+"&download=1&requestid='\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/down_wev8.png\"></a> ";
                            sumkb += docImagefileSize;
                        }
                    }
                    if(count>1 && moreValue==1  && !"1".equals(norightlist))
                        returnStr+="<a onclick=\"top.location='"+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fieldvalue="+docs+"&delImgIds="+attachids+"&download=1&downloadBatch=1&requestid='\" class=\"alldown\" style=\"cursor:pointer;\"><img src=\""+weaver.general.GCONST.getContextPath()+"/formmode/images/alldown_wev8.png\"></a> ";
                }
            }else if(fieldhtmltype.equals("8")){                     // 公共选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeSql("select * from mode_selectitempagedetail where id='"+fieldvalue+"'");
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("id"));
                    String tmpselectname = Util.toScreen(rs.getString("name"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }
        } catch (Exception e) {
            returnStr="";
        }
        return returnStr;
    }

    /**
     * 获得自定义显示字段的显示内容
     * @param paraTwo  字段ID+"+"+字段类型+"+"+字段类型+"+"+显示语言
     * @return 显示内容
     */
    public String getBrowserOthers (String fieldvalue,String paraTwo) {
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        String sql = "";
        String[] tempStr = Util.TokenizerString2(paraTwo, "+");
        if(tempStr.length==0){
            return fieldvalue;
        }
        String fieldid = Util.null2String(tempStr[1]);
        String fieldhtmltype = Util.null2String(tempStr[2]);
        String fieldtype = Util.null2String(tempStr[3]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4]));
        String modedataid = Util.null2String(Util.StringReplace(tempStr[0],"{weaver}", "+"));
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5]);
        String dbtype = Util.null2String(tempStr[6]);
        String istitle = Util.null2String(tempStr[7]);
        String formmodeid = Util.null2String(tempStr[8]);
        String formID = Util.null2String(tempStr[9]);
        String viewtype = Util.null2String(tempStr[10]);
        String pkfield = "id";
        String detailtable = "";
        if(tempStr.length>14){
            pkfield = Util.null2String(tempStr[14]).replace(" ", "");
        }
        if(tempStr.length>15){
            detailtable = Util.null2String(tempStr[15]);
        }
        boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formID);
        String vdatasource = "";
        if(isVirtualForm){
            Map<String,Object> vFormInfo = VirtualFormHandler.getVFormInfo(formID);
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
            if(pkfield.equals("")){
                pkfield = Util.null2String(vFormInfo.get("vprimarykey"));	//主键列名称
            }
        }
        RecordSet recordSet = new RecordSet();
        int opentype = 0;
        int customid = 0;
        String showmethod = "";
        String viewfrom = "";//来源
        if(formmodeid.equals("0")){
            //String sqlStr = "select formmodeid from formtable_main_"+formID.replace("-", "")+" where id="+modedataid;
            String tablename = "";
            String sqlStr = "select tablename from workflow_bill where id="+formID;
            RecordSet.executeSql(sqlStr);
            if (RecordSet.next()) {
                tablename = Util.null2String(RecordSet.getString("tablename"));
            }
            if(isVirtualForm){
                tablename = VirtualFormHandler.getRealFromName(tablename);
            }

            if (!StringHelper.isEmpty(tablename)) {
                sqlStr = "select * from "+tablename+" where id="+modedataid;
                RecordSet.executeSql(sqlStr);
                if(RecordSet.next()){
                    formmodeid = Util.null2String(RecordSet.getString("formmodeid"),"0");
                }
            }
        }else if(formmodeid.equals("virtual")){
            formmodeid = "0";
        }
        if(tempStr.length>12){
            opentype = Util.getIntValue(tempStr[11],0);
            customid = Util.getIntValue(tempStr[12],0);
        }
        if(tempStr.length>13){
            viewfrom = Util.null2String(tempStr[13]);
        }
        if(tempStr.length>14){
            showmethod = Util.null2String(tempStr[14]);
        }
        try{
            if (fieldtype.equals("118")) {
                returnStr="<a href=\'"+weaver.general.GCONST.getContextPath()+"/meeting/report/MeetingRoomPlan.jsp\' target=\'_blank\'>"+SystemEnv.getHtmlLabelName(2193,userlanguage)+"</a>";
            }
            if(fieldhtmltype.equals("1") || fieldhtmltype.equals("2") ){  // 单行,多行文本框
                if(fieldhtmltype.equals("1") && fieldtype.equals("4")){
                    returnStr= Util.milfloatFormat(fieldvalue);
                } if(fieldhtmltype.equals("2")&& fieldtype.equals("2")) {
                    returnStr = fieldvalue.replaceAll("(<script[^>]*?>)(.*)(</script>)", "");;
                } else{
                    returnStr=  toHtmlSearch(fieldvalue);
                    returnStr = returnStr.replaceAll("<", "&lt;");
                    returnStr = returnStr.replaceAll(">", "&gt;");
                }

            }                                                         // 单行,多行文本框条件结束
            else if(fieldhtmltype.equals("3")){                         // 浏览按钮 (涉及workflow_broswerurl表)
                if(fieldtype.equals("2") || fieldtype.equals("19")){    // 日期和时间
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("290")){//时间日期字段
                    returnStr="".equals(Util.null2String(fieldvalue))?"":new DateTransformer().getLocaleDateTime(fieldvalue);
                } else if(fieldtype.equals("402") || fieldtype.equals("403")){    // 年、年月
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("224")||fieldtype.equals("225") ||fieldtype.equals("226")||fieldtype.equals("227")){
                    returnStr=fieldvalue;
                } else if(!fieldvalue.equals("")) {
                    String linkurl=getBrowserLinkurl(fieldtype);    // 浏览值点击的时候链接的url
                    String showname = "";                                                   // 值显示的名称
                    String showid = "";                                                     // 值

                    ArrayList tempshowidlist=Util.TokenizerString(fieldvalue,",");
                    if(fieldtype.equals("8") || fieldtype.equals("135")){
                        //项目，多项目
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("1") ||fieldtype.equals("17")||fieldtype.equals("165") ||fieldtype.equals("166")){
                        //人员，多人员
                        for(int k=0;k<tempshowidlist.size();k++){
                        	showname+="<a href='javaScript:openhrm("+tempshowidlist.get(k)+");' onclick='pointerXY(event);'>"+rc.getResourcename((String)tempshowidlist.get(k))+"</a>&nbsp;";
                        }
                    }else if(fieldtype.equals("7") || fieldtype.equals("18")){
                        //客户，多客户
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+cci.getCustomerInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=cci.getCustomerInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("4") || fieldtype.equals("57")|| fieldtype.equals("167")|| fieldtype.equals("168")){
                        //部门，多部门
                        orgShowBiz = new OrganizationShowSetBiz();
                        String sepCharacter = orgShowBiz.getSepCharacter();
                        for(int k=0;k<tempshowidlist.size();k++){
                            String departmentShow = orgShowBiz.getDepartmentShow("model", (String)tempshowidlist.get(k));
                            if(sepCharacter.equals(departmentShow)){
                                departmentShow = "";
                            }
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+departmentShow+"</a>&nbsp;";
                            }else{
                                if(!departmentShow.equals("")) {
                                    showname += departmentShow + " ";
                                }
                            }
                        }
                    }else if(fieldtype.equals("9") || fieldtype.equals("37")){
                        //文档，多文档
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";

                            {
                                if(!linkurl.equals("")){
                                    showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"&modedataid="+modedataid+"\' target=\'_new\'>"+DocComInfo1.getDocname((String)tempshowidlist.get(k))+"</a>";
                                }else{
                                    showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k));
                                }
                            }
                        }
                    }else if(fieldtype.equals("23")){
                        //资产
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("16") || fieldtype.equals("152")|| fieldtype.equals("171")){
                        //相关请求
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";
                            if(!linkurl.equals("")){
                                int tempnum=0;
                                tempnum++;

                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"&wflinkno="+tempnum+"\' target=\'_new\'>"+WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+"</a>";
                            }else{
                                showname+=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k));
                            }
                        }
                    }else if(fieldtype.equals("141")){
                        //人力资源条件
                        showname+=rcm.getFormShowName(fieldvalue,userlanguage);
                    }
                    //added by alan for td:10814
                    else if(fieldtype.equals("142")) {
                        //收发文单位
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                                showname += "<a href='"+linkurl+tempshowidlist.get(k)+"' target='_new'>"+ duc.getReceiveUnitName(""+tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname += duc.getReceiveUnitName(""+tempshowidlist.get(k))+" ";
                            }
                        }
                    }
                    else if(fieldtype.equals("161")){//自定义单选
                        showname = "";                                   // 新建时候默认值显示的名称
                        String showdesc="";
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, showid,null);
                            String desc=Util.null2String(bb.getDescription());
                            String name=Util.null2String(bb.getName());
//							showname="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                            String href=Util.null2String(bb.getHref());
                            if(href.equals("")){
                                showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                            }else{
                                String tempcustomid = Util.null2String(browser.getCustomid());
                                href = new ButtonElement().getHrefByBrowser(tempcustomid, href, showid, recordSet);
                                showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    }
                    else if(fieldtype.equals("162")){//自定义多选
                        showname = "";                                   // 新建时候默认值显示的名称
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            List l=Util.TokenizerString(showid,",");
                            for(int j=0;j<l.size();j++){
                                String curid=(String)l.get(j);
                                BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, curid,null);
                                String name=Util.null2String(bb.getName());
                                ////System.out.println("showname:"+showname);
                                String desc=Util.null2String(bb.getDescription());
//							    showname+="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                                String href=Util.null2String(bb.getHref());
                                if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                                	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
        						}
                                if(href.equals("")){
                                    showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                }else{
                                    String tempcustomid = Util.null2String(browser.getCustomid());
                                    href = new ButtonElement().getHrefByBrowser(tempcustomid, href, curid, recordSet);
                                    showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                                }
                            }
                        }catch(Exception e){
                        }
                    }else if (fieldtype.equals("256")||fieldtype.equals("257")) {//自定义树形单选
                        CustomTreeUtil customTreeUtil = new CustomTreeUtil();
                        showid = fieldvalue;
                        if(this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true") ){
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname");
                        }else{
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype);
                        }

                    }else{
                        String tablename=BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                        String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                        String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        if(fieldvalue.indexOf(",")!=-1){
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+" in( "+fieldvalue+")";
                        }
                        else {
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+"="+fieldvalue;
                        }
                        RecordSet.executeSql(sql);
                        while(RecordSet.next()){
                            if(!linkurl.equals("") ){
                                showname += "<a href=\'"+linkurl+RecordSet.getString(1)+"\' target=\'_new\'>"+Util.toScreen(RecordSet.getString(2),userlanguage)+"</a>&nbsp;";
                            }else{
                                showname +=Util.toScreen(RecordSet.getString(2),userlanguage)+" ";
                            }
                        }    // end of while
                    }
                    returnStr=showname;
                }
            }                                                       // 浏览按钮条件结束
            else if(fieldhtmltype.equals("4")) {                    // check框
                returnStr=fieldvalue;
            }                                                       // check框条件结束
            else if(fieldhtmltype.equals("5")){                     // 选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+isbill);
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                    String tmpselectname = Util.toScreen(rs.getString("selectname"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }else if(fieldhtmltype.equals("6")){
                if(!fieldvalue.equals("")) {
                    sql="select id,docsubject,accessorycount from docdetail where id in("+fieldvalue+") order by id asc";
                    int linknum=-1;
                    RecordSet.executeSql(sql);
                    while(RecordSet.next()){
                        linknum++;
                        if(linknum>0) returnStr+="<br>";
                        String showid = Util.null2String(RecordSet.getString(1)) ;
                        String tempshowname= Util.toScreen(RecordSet.getString(2),userlanguage) ;
                        int accessoryCount=RecordSet.getInt(3);

                        DocImageManager.resetParameter();
                        DocImageManager.setDocid(Integer.parseInt(showid));
                        DocImageManager.selectDocImageInfo();

                        String docImagefileid = "";
                        long docImagefileSize = 0;
                        String docImagefilename = "";
                        String fileExtendName = "";
                        int versionId = 0;
                        if(DocImageManager.next()){
                            docImagefileid = DocImageManager.getImagefileid();
                            docImagefileSize = DocImageManager.getImageFileSize(Util.getIntValue(docImagefileid));
                            docImagefilename = DocImageManager.getImagefilename();
                            fileExtendName = docImagefilename.substring(docImagefilename.lastIndexOf(".")+1).toLowerCase();
                            versionId = DocImageManager.getVersionId();
                        }

                        if(accessoryCount==1 && (fileExtendName.equalsIgnoreCase("xls")||fileExtendName.equalsIgnoreCase("doc")||fileExtendName.equalsIgnoreCase("pdf")
                        		||fileExtendName.equalsIgnoreCase("xlsx")||fileExtendName.equalsIgnoreCase("docx")
                        		)){
                            returnStr+= "<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index2file.jsp?id="+showid+"&imagefileId="+docImagefileid+"&isFromAccessory=true\")>"+docImagefilename+"</a> ";
                        }else{
                            returnStr+="<a href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/spa/document/index.jsp?id="+showid+"\")>"+tempshowname+"</a> ";
                        }
                    }
                }
            }else if(fieldhtmltype.equals("8")){                     // 公共选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeSql("select * from mode_selectitempagedetail where id='"+fieldvalue+"'");
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("id"));
                    String tmpselectname = Util.toScreen(rs.getString("name"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }
        } catch (Exception e) {
            returnStr="";
        }


        //单行文本和下拉字段的值可以作为标题
        if ((fieldhtmltype.equals("1") || fieldhtmltype.equals("5")) && !istitle.equals("0")) {
            String hreflink="";
            String custmomfield = "select hreflink from Mode_CustomDspField where fieldid="+fieldid+" and customid="+customid;
            RecordSet.executeSql(custmomfield);
            if (RecordSet.next()) {
                hreflink = Util.null2String(RecordSet.getString("hreflink"));
            }
            hreflink = Util.replaceString(hreflink, "$type$", viewtype);
            hreflink = Util.replaceString(hreflink, "$modeId$", formmodeid);
            hreflink = Util.replaceString(hreflink, "$formId$", formID);
            hreflink = Util.replaceString(hreflink, "$billid$", modedataid);
            hreflink = Util.replaceString(hreflink, "$opentype$", Util.null2String(opentype));
            hreflink = Util.replaceString(hreflink, "$customid$", Util.null2String(customid));
            hreflink = Util.replaceString(hreflink, "$viewfrom$", Util.null2String(viewfrom));

            String tablename = "";
            String sqlStr = "select tablename from workflow_bill where id="+formID;
            RecordSet.executeSql(sqlStr);
            if (RecordSet.next()) {
                tablename = Util.null2String(RecordSet.getString("tablename"));
            }
            if(isVirtualForm){
                tablename = VirtualFormHandler.getRealFromName(tablename);
            }
            String requestid = "0";
            String sqltablename = tablename;
            if(!"".equals(detailtable)){
                sqltablename = detailtable;
            }
            String datesql ="select * from "+sqltablename +" where "+("".equals(pkfield)?"id":pkfield)+"='"+modedataid+"'";
            if(isVirtualForm){
                RecordSet.executeSql(datesql,vdatasource);
            }else{
                RecordSet.executeSql(datesql);
            }
            if(RecordSet.next()){
                requestid = RecordSet.getString("requestId");
                hreflink = Util.replaceString(hreflink, "$requestId$", requestid);
                RecordSet RecordSetfield = new RecordSet();
                String fieldsql = "select * from workflow_billfield where billid="+formID;
                RecordSetfield.executeSql(fieldsql);
                while(RecordSetfield.next()){
                    String fieldname = RecordSetfield.getString("fieldname");
                    hreflink = Util.replaceString(hreflink, "$"+fieldname+"$", RecordSet.getString(fieldname));
                }
            }
            if(hreflink!=null&&hreflink.startsWith("/")&&!hreflink.startsWith(weaver.general.GCONST.getContextPath())){
                hreflink = weaver.general.GCONST.getContextPath()+hreflink;
            }
            if(istitle.equals("1")){
                String titleStr = returnStr;
                if(titleStr.indexOf("'")!=-1){
                    titleStr = titleStr.replace("'", "%27");
                }
                //表单
                if(opentype==1){
                    //returnStr = "<a href=\"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\">"+returnStr+"</a> ";
                    if("".equals(hreflink)){
                        returnStr = "<a title='"+titleStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\""+weaver.general.GCONST.getContextPath()+"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\")>"+returnStr+"</a> ";
                    }else{
                        returnStr = "<a title='"+titleStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\""+hreflink+"\")>"+returnStr+"</a> ";
                    }
                }else{
                    if("".equals(hreflink)){
                        returnStr = "<a title='"+titleStr+"' href=javascript:openFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\")>"+returnStr+"</a> ";
                    }else{
                        returnStr = "<a title='"+titleStr+"' href=javascript:openFullWindowHaveBar(\""+hreflink+"\")>"+returnStr+"</a> ";
                    }
                }
            }else if(istitle.equals("2")){
                //流程
                if("".equals(hreflink)){
                    returnStr = "<a title='"+returnStr+"' href=javascript:openFullWindowHaveBarForWFList(\""+weaver.general.GCONST.getContextPath()+"/workflow/request/ViewRequest.jsp?requestid="+requestid+"&isovertime=0,\""+requestid+"\")>"+returnStr+"</a> ";
                }else{
                    returnStr = "<a title='"+returnStr+"' href=javascript:openFullWindowHaveBarForWFList(\""+hreflink+"\",\""+requestid+"\")>"+returnStr+"</a> ";
                }
            }else if(istitle.equals("3")){
                //自定义
                if(opentype==1){
                    if("".equals(hreflink)){
                        returnStr = "<span title='"+returnStr+"'>"+returnStr+"</span> ";
                    }else{
                        returnStr = "<a title='"+returnStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\""+hreflink+"\")>"+returnStr+"</a> ";
                    }
                }else{
                    if("".equals(hreflink)){
                        returnStr = "<span title='"+returnStr+"' >"+returnStr+"</span> ";
                    }else{
                        returnStr = "<a title='"+returnStr+"' href=javascript:openFullWindowHaveBar(\""+hreflink+"\")>"+returnStr+"</a> ";
                    }
                }
            }

        }
        return returnStr;
    }

    /**
     * 查询参数条件内容转换
     * @param paraTwo  字段ID+"+"+字段类型+"+"+字段类型+"+"+显示语言
     * @return 显示内容
     */
    public String getOthersSearchname(String fieldvalue,String paraTwo) {
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        String sql = "";
        boolean isshowmethod = false;
        if(paraTwo.indexOf("noshowmethod")>-1){
            isshowmethod = true;
            paraTwo = paraTwo.replace("+noshowmethod", "");
        }
        String[] tempStr = Util.TokenizerString2(paraTwo, "+");
        String fieldid = Util.null2String(tempStr[1]);
        String fieldhtmltype = Util.null2String(tempStr[2]);
        String fieldtype = Util.null2String(tempStr[3]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4]));
        String modedataid = Util.null2String(tempStr[0]);
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5]);
        String dbtype = Util.null2String(tempStr[6]);
        String istitle = Util.null2String(tempStr[7]);
        String formmodeid = Util.null2String(tempStr[8]);
        String formID = Util.null2String(tempStr[9]);
        String viewtype = Util.null2String(tempStr[10]);
        boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formID);
        String norightlist = "";
        /**无权限列表处理*/
        if(tempStr.length>=13){
            CustomSearchService customSearchService=new CustomSearchService();
            String repordid = Util.null2String(tempStr[12]);
            Map<String,Object> map=customSearchService.getCustomSearchById(Util.getIntValue(repordid,0));
            if(map.size()>0){
                norightlist=Util.null2String(map.get("norightlist"));
            }
        }
        String vdatasource = "";
        if(isVirtualForm){
            Map<String,Object> vFormInfo = VirtualFormHandler.getVFormInfo(formID);
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
        }
        int opentype = 0;
        int customid = 0;
        String showmethod = "";
        int userid = 0;
        int enabled = -1;
        boolean isenabled = false;
        String viewfrom = "";//来源
        RecordSet recordSet = new RecordSet();
        if(formmodeid.equals("0")){
            //String sqlStr = "select formmodeid from formtable_main_"+formID.replace("-", "")+" where id="+modedataid;
            String tablename = "";
            String sqlStr = "select tablename from workflow_bill where id="+formID;
            RecordSet.executeSql(sqlStr);
            if (RecordSet.next()) {
                tablename = Util.null2String(RecordSet.getString("tablename"));
            }
            if(isVirtualForm){
                tablename = VirtualFormHandler.getRealFromName(tablename);
            }
            if (!StringHelper.isEmpty(tablename)) {
                sqlStr = "select formmodeid from "+tablename+" where id="+modedataid;
                RecordSet.executeSql(sqlStr);
                if(RecordSet.next()){
                    formmodeid = RecordSet.getString("formmodeid");
                }
            }
        }else if(formmodeid.equals("virtual")){
            formmodeid = "0";
        }
        if(tempStr.length>13){
            opentype = Util.getIntValue(tempStr[11],0);
            customid = Util.getIntValue(tempStr[12],0);
            viewfrom = Util.null2String(tempStr[13]);
        }
        if(tempStr.length>14){
            showmethod = Util.null2String(tempStr[14]);
        }

        isenabled =customSearchComInfo.getEnabled(customid+"");
        if(tempStr.length>15){
            userid = Util.getIntValue(tempStr[15]);
            enabled = Util.getIntValue(tempStr[16]);
        }

        if(isshowmethod){
            showmethod = "0";
        }

        try{
            if (fieldtype.equals("118")) {
                returnStr="<a href=\""+weaver.general.GCONST.getContextPath()+"/meeting/report/MeetingRoomPlan.jsp\" target=\"_blank\">"+SystemEnv.getHtmlLabelName(2193,userlanguage)+"</a>";
            }
            if(fieldhtmltype.equals("1") || fieldhtmltype.equals("2") ){  // 单行,多行文本框
                if(fieldhtmltype.equals("1") && fieldtype.equals("4")){
                    returnStr= Util.milfloatFormat(fieldvalue);
                }else{
                    returnStr=Util.toHtmlSearch(fieldvalue);
                }
            }                                                         // 单行,多行文本框条件结束
            else if(fieldhtmltype.equals("3")){                         // 浏览按钮 (涉及workflow_broswerurl表)
                if(fieldtype.equals("2") || fieldtype.equals("19")){    // 日期和时间
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("290")){//时间日期字段
                    returnStr="".equals(Util.null2String(fieldvalue))?"":new DateTransformer().getLocaleDateTime(fieldvalue);
                } else if(fieldtype.equals("402") || fieldtype.equals("403")){    // 年、年月
                    returnStr=fieldvalue;
                } else if(fieldtype.equals("224")||fieldtype.equals("225") ||fieldtype.equals("226")||fieldtype.equals("227")){
                    returnStr=fieldvalue;
                } else if(!fieldvalue.equals("")) {
                    String url=BrowserComInfo.getBrowserurl(fieldtype);     // 浏览按钮弹出页面的url
                    String linkurl=getBrowserLinkurl(fieldtype);    // 浏览值点击的时候链接的url
                    //去掉<a>标签
                    //linkurl = "";
                    String showname = "";                                                   // 值显示的名称
                    String showid = "";                                                     // 值

                    ArrayList tempshowidlist=Util.TokenizerString(fieldvalue,",");
                    if(fieldtype.equals("8") || fieldtype.equals("135")){
                        //项目，多项目
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("1") ||fieldtype.equals("17")||fieldtype.equals("165") ||fieldtype.equals("166")){
                        //人员，多人员
                        for(int k=0;k<tempshowidlist.size();k++){
                        	showname+="<a href=javaScript:openhrm("+tempshowidlist.get(k)+") onclick=pointerXY(event)>"+rc.getResourcename((String)tempshowidlist.get(k))+"</a>&nbsp;";
                        }
                    }else if(fieldtype.equals("7") || fieldtype.equals("18")){
                        //客户，多客户
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+cci.getCustomerInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=cci.getCustomerInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("4") || fieldtype.equals("57")|| fieldtype.equals("167")|| fieldtype.equals("168")){
                        //部门，多部门
                        orgShowBiz = new OrganizationShowSetBiz();
                        String sepCharacter = orgShowBiz.getSepCharacter();
                        for(int k=0;k<tempshowidlist.size();k++){
                            String departmentShow = orgShowBiz.getDepartmentShow("model", (String)tempshowidlist.get(k));
                            if(sepCharacter.equals(departmentShow)){
                                departmentShow = "";
                            }
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+departmentShow+"</a>&nbsp;";
                            }else{
                                if(!departmentShow.equals("")) {
                                    showname += departmentShow + " ";
                                }
                            }
                        }
                    }else if(fieldtype.equals("164") || fieldtype.equals("194")||fieldtype.equals("170")||fieldtype.equals("169")){      //分部
                        //分部，多分部，单权分部，单权多分部
                        orgShowBiz = new OrganizationShowSetBiz();
                        String sepCharacter = orgShowBiz.getSepCharacter();
                        for(int k=0;k<tempshowidlist.size();k++){
                            String subcompanyShow = orgShowBiz.getSubcompanyShow("model", (String)tempshowidlist.get(k));
                            if(sepCharacter.equals(subcompanyShow)){
                                subcompanyShow = "";
                            }
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+subcompanyShow+"</a>&nbsp;";
                            }else{
                                if(!subcompanyShow.equals("")) {
                                    showname += subcompanyShow + " ";
                                }
                            }
                        }
                    }else if(fieldtype.equals("9") || fieldtype.equals("37")){
                        //文档，多文档
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";

                            {
                                if(!linkurl.equals("")){
                                    showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"&modedataid="+modedataid+"\" target=\"_new\">"+DocComInfo1.getDocname((String)tempshowidlist.get(k))+"</a>";
                                }else{
                                    showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k));
                                }
                            }
                        }
                    }else if(fieldtype.equals("23")){
                        //资产
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("317")){
                        //多资产没有url
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k == tempshowidlist.size()-1){
                                showname+= CapitalAssortmentComInfo.getAssortmentName((String)tempshowidlist.get(k));
                            }else{
                                showname+= CapitalAssortmentComInfo.getAssortmentName((String)tempshowidlist.get(k))+",";
                            }
                        }
                    }else if(fieldtype.equals("16") || fieldtype.equals("152")|| fieldtype.equals("171")){
                        //相关请求
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";
                            if(!linkurl.equals("")){
                                int tempnum=0;
                                tempnum++;

                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"&wflinkno="+tempnum+"\" target=\"_new\">"+WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+"</a>";
                            }else{
                                showname+=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k));
                            }
                        }
                    }else if(fieldtype.equals("141")){
                        //人力资源条件
                        showname+=rcm.getFormShowName(fieldvalue,userlanguage);
                    }
                    //added by alan for td:10814
                    else if(fieldtype.equals("142")) {
                        //收发文单位
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                                showname += "<a href='"+linkurl+tempshowidlist.get(k)+"' target='_new'>"+ duc.getReceiveUnitName(""+tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname += duc.getReceiveUnitName(""+tempshowidlist.get(k))+" ";
                            }
                        }
                    }
                    else if(fieldtype.equals("161")){//自定义单选
                        showname = "";                                   // 新建时候默认值显示的名称
                        String showdesc="";
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, showid,null);
                            String desc=Util.null2String(bb.getDescription());
                            String name=Util.null2String(bb.getName());
                            String href=Util.null2String(bb.getHref());
                            if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                            	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
    						}
                            if(href.equals("")){
                                showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                            }else{
                                String tempcustomid = Util.null2String(browser.getCustomid());
                                href = new ButtonElement().getHrefByBrowser(tempcustomid, href, showid, recordSet);
                                showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    }
                    else if(fieldtype.equals("162")){//自定义多选
                        showname = "";                                   // 新建时候默认值显示的名称
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            List l=Util.TokenizerString(showid,",");
                            for(int j=0;j<l.size();j++){
                                String curid=(String)l.get(j);
                                BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, curid,null);
                                String name=Util.null2String(bb.getName());
                                String desc=Util.null2String(bb.getDescription());
                                String href=Util.null2String(bb.getHref());
                                if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                                	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
        						}
                                if(href.equals("")){
                                    showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                }else{
                                    String tempcustomid = Util.null2String(browser.getCustomid());
                                    href = new ButtonElement().getHrefByBrowser(tempcustomid, href, curid, recordSet);
                                    showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                                }
                            }
                        }catch(Exception e){
                        }
                    }else if (fieldtype.equals("256")||fieldtype.equals("257")) {//自定义树形单选
                        CustomTreeUtil customTreeUtil = new CustomTreeUtil();
                        showid = fieldvalue;
                        if(this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true") ){
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname");
                        }else{
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"openByTreeField");
                        }

                    }else{
                        String tablename=BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                        String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                        String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        if(fieldvalue.indexOf(",")!=-1){
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+" in( "+fieldvalue+")";
                        }
                        else {
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+"="+fieldvalue;
                        }
                        RecordSet.executeSql(sql);
                        while(RecordSet.next()){
                            if(!linkurl.equals("") ){
                                showname += "<a href=\""+linkurl+RecordSet.getString(1)+"\" target=\"_new\">"+Util.toScreen(RecordSet.getString(2),userlanguage)+"</a>&nbsp;";
                            }else{
                                showname +=Util.toScreen(RecordSet.getString(2),userlanguage)+" ";
                            }
                        }    // end of while
                    }
                    returnStr=showname;
                }
            }                                                       // 浏览按钮条件结束
            else if(fieldhtmltype.equals("4")) {                    // check框
                returnStr=fieldvalue;
            }                                                       // check框条件结束
            else if(fieldhtmltype.equals("5")){                     // 选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+isbill);
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                    String tmpselectname = Util.toScreen(rs.getString("selectname"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }else if(fieldhtmltype.equals("6")){ //文档（附件）
                if(!fieldvalue.equals("")) {
                    String docs = "";
                    String attachids = "";
                    int count =0;
                    long sumkb = 0;
                    sql="select id,docsubject,accessorycount from docdetail where id in("+fieldvalue+") order by id asc";
                    int linknum=-1;
                    RecordSet.executeSql(sql);
                    int singleValue=0;
                    int moreValue=0;
                    rs.executeSql("select singlevalue,morevalue from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
                    while(rs.next()){
                        singleValue = rs.getInt("singlevalue");
                        moreValue = rs.getInt("morevalue");
                    }
                    while(RecordSet.next()){
                        linknum++;
                        if(linknum>0) returnStr+="<br>";
                        String showid = Util.null2String(RecordSet.getString(1)) ;
                        String tempshowname= Util.toScreen(RecordSet.getString(2),userlanguage) ;
                        int accessoryCount=RecordSet.getInt(3);

                        DocImageManager.resetParameter();
                        DocImageManager.setDocid(Integer.parseInt(showid));
                        DocImageManager.selectDocImageInfo();

                        String docImagefileid = "";
                        long docImagefileSize = 0;
                        String docImagefilename = "";
                        String fileExtendName = "";
                        int versionId = 0;
                        if(DocImageManager.next()){
                            docImagefileid = DocImageManager.getImagefileid();
                            docImagefileSize = DocImageManager.getImageFileSize(Util.getIntValue(docImagefileid));
                            docImagefilename = DocImageManager.getImagefilename();
                            fileExtendName = docImagefilename.substring(docImagefilename.lastIndexOf(".")+1).toLowerCase();
                            versionId = DocImageManager.getVersionId();
                        }
                        docs+=showid+",";
                        count ++;
                        attachids+=docImagefileid+",";

                        returnStr+=tempshowname+" ";
                    }
                }
            }else if(fieldhtmltype.equals("8")){                     // 公共选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeSql("select * from mode_selectitempagedetail where id='"+fieldvalue+"'");
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("id"));
                    String tmpselectname = Util.toScreen(rs.getString("name"),userlanguage);
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }
        } catch (Exception e) {
            returnStr="";
        }
        return returnStr;
    }

    /**
     * 去除前后指定字符
     * @param str
     * @param splitstr
     * @return
     */
    public String deleteFirstAndEndchar(String str, String splitstr) {
        boolean needround = false;
        if (str.substring(0, splitstr.length()).equals(splitstr)) {
            str = str.substring(splitstr.length());
            needround = true;
        }
        if (str.substring(str.length() - splitstr.length()).equals(splitstr)) {
            str = str.substring(0, str.length() - splitstr.length());
            needround = true;
        }
        if (needround) {
            return deleteFirstAndEndchar(str, splitstr);
        } else {
            return str;
        }
    }
    public String getIsmultiprintStr(String ismultiprint, String language){
        String retStr = "";
        try {
            int languageid = Util.getIntValue(language, 7);
            if ("1".equals(ismultiprint)) {
                retStr = SystemEnv.getHtmlLabelName(27046, languageid);
            } else {
                retStr = SystemEnv.getHtmlLabelName(27045, languageid);
            }
        } catch (Exception e) {
            retStr = SystemEnv.getHtmlLabelName(27045, 7);
        }
        return retStr;
    }

    /**
     * @param str :
     *            source string
     * @param width :
     *            string's byte width
     * @param ellipsis :
     *            a string added to abbreviate string bottom
     * @return String Object
     *
     */
    public String Html2Text(String inputString) {
        String htmlStr = inputString; // 含html标签的字符串
        String textStr = "";
//        java.util.regex.Pattern p_script;
//        java.util.regex.Matcher m_script;

        try {
//            String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>"; // 定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script>
//            p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
//            m_script = p_script.matcher(htmlStr);
//            htmlStr = m_script.replaceAll(""); // 过滤script标签
//
//            textStr = htmlStr;

            Pattern patt=Pattern.compile("<[^>]+>([^<]*)</[^>]+>");
            Matcher m=patt.matcher(htmlStr);
            while(m.find()){
                htmlStr=htmlStr.replaceFirst("<[^>]+>([^<]*)</[^>]+>", m.group(1).toString());
            }
            textStr = htmlStr;

        } catch (Exception e) {
            this.formmodeLog.writeLog(e);
        }

        return textStr;// 返回文本字符串
    }

    /**
     * 获得所有下级部门ID
     * @param depId
     * @return
     */
    public String getAllChildDeptByDepId(String depId){
        String str = "";
        try{
            if(depId.equals("0")){
                return str;
            }
            SubCompanyComInfo SubCompanyComInfo = new SubCompanyComInfo();
            str = SubCompanyComInfo.getDepartmentTreeStr(depId);
        }catch(Exception e){
            this.formmodeLog.writeLog(e);
        }
        return str;
    }

    /**
     * 获得所有下级分部ID
     * @param depId
     * @return
     */
    public String getAllChildSubBySubId(String subId){
        String str = "";
        try{
            if(subId.equals("0")){
                return str;
            }
            //SubCompanyComInfo SubCompanyComInfo = new SubCompanyComInfo();
            str = SubCompanyComInfo.getSubCompanyTreeStr(subId);
        }catch(Exception e){
            this.formmodeLog.writeLog(e);
        }
        return str;
    }

    /**
     * 获得本周，本月，本季，本年开始和结束日期
     * @param datetype
     * @return
     */
    public String[] getOperatorDate(String datetype){
        String str[] = new String[2];
        String datefrom = "";
        String dateto = "";
        Calendar now = Calendar.getInstance();
        String today=Util.add0(now.get(Calendar.YEAR), 4) +"-"+Util.add0(now.get(Calendar.MONTH) + 1, 2) +"-"+Util.add0(now.get(Calendar.DAY_OF_MONTH), 2) ;
        int year=now.get(Calendar.YEAR);
        int month=now.get(Calendar.MONTH);
        int day=now.get(Calendar.DAY_OF_MONTH);
        if("1".equals(datetype)){
            int days=now.getTime().getDay();
            Calendar tempday = Calendar.getInstance();
            tempday.clear();
            tempday.set(year,month,day-days);
            String lastday = Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
            datefrom = lastday;
            dateto = today;
        }else if("2".equals(datetype)){
            Calendar tempday = Calendar.getInstance();
            tempday.clear();
            tempday.set(year,month,1);
            String lastday = Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ;
            datefrom = lastday;
            dateto = today;
        }else if("3".equals(datetype)){
            Calendar tempday = Calendar.getInstance();
            tempday.clear();
            tempday.set(year,month,1);
            String month_season = "";
            if(0<=month && month<=2){
                month_season = "01";
            }else if(3<=month && month<=5){
                month_season = "04";
            }else if(6<=month && month<=8){
                month_season = "07";
            }else{
                month_season = "10";
            }
            String lastday = Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+month_season+"-01";
            datefrom = lastday;
            dateto = today;
        }else if("4".equals(datetype)){
            Calendar tempday = Calendar.getInstance();
            tempday.clear();
            tempday.set(year,month,1);
            String lastday = Util.add0(tempday.get(Calendar.YEAR), 4) +"-01-01";
            datefrom = lastday;
            dateto = today;
        }
        str[0] = datefrom;
        str[1] = dateto;

        return str;
    }

    /**
     * 获得快捷搜索的sql
     * @param user	用户
     * @param thisdate 1本周,2本月,3本季,4本年
     * @param thisorg 1本部门,2本部门(包含下级部门),3本分部,4本分部(包含下级分部)
     * @return
     */
    public String getQuickSearch(User user,String thisdate,String thisorg){
        String str = "";
        String userdepartmentid = String.valueOf(user.getUserDepartment());
        String usersubcompanyid = String.valueOf(user.getUserSubCompany1());
        String subDepIds = userdepartmentid;
        String subSubIds = usersubcompanyid;

        if(thisorg.equals("1")){//1本部门
            str += " and exists (select 1 from hrmresource where id = t1.modedatacreater and departmentid in ("+subDepIds+"))";
        }else if(thisorg.equals("2")){//2本部门(包含下级部门)
            subDepIds = getAllChildDeptByDepId(subDepIds);
            if(subDepIds.equals("")){
                subDepIds = userdepartmentid;
            }else{
                if(subDepIds.endsWith(",")){
                    subDepIds = subDepIds.substring(0, subDepIds.length()-1);
                }
                subDepIds = userdepartmentid + "," + subDepIds;
            }
            str += " and exists (select 1 from hrmresource where id = t1.modedatacreater and departmentid in ("+subDepIds+"))";
        }else if(thisorg.equals("3")){//3本分部
            str += " and exists (select 1 from hrmresource where id = t1.modedatacreater and subcompanyid1 in ("+subSubIds+"))";
        }else if(thisorg.equals("4")){//4本分部(包含下级分部)
            subSubIds = getAllChildSubBySubId(subSubIds);
            if(subSubIds.equals("")){
                subSubIds = usersubcompanyid;
            }else{
                if(subSubIds.endsWith(",")){
                    subSubIds = subSubIds.substring(0, subSubIds.length()-1);
                }
                subSubIds = usersubcompanyid + "," + subSubIds;
            }
            str += " and exists (select 1 from hrmresource where id = t1.modedatacreater and subcompanyid1 in ("+subSubIds+"))";
        }

        String dates[] = getOperatorDate(thisdate);
        if(!dates[0].equals("")){
            str += " and t1.modedatacreatedate >= '"+dates[0]+"' ";
        }
        if(!dates[1].equals("")){
            str += " and t1.modedatacreatedate <= '"+dates[1]+"' ";
        }

        return str;
    }

    /**
     * 获得数据状态的sql
     * @param user	用户
     * @param enabled 1未读、2反馈和3已读
     * @param modeid 模块ID
     * @return
     */
    public String getEnabledSql(User user,String enabled,int modeid){
        String str = null;
        String tablename = "ModeViewLog_"+modeid;
        String nullFun = CommonConstant.DB_ISNULL_FUN;
        // CHANGE START
        String primarykey = ShardingActionHelper.getPrimaryKey(modeid);
        String relatedkey = ShardingActionHelper.getRelatedKey(modeid);
        // CHANGE END
        if("1".equals(enabled)){
            //不存在查看记录，并且新建不是自己（由于一般保存后会有查看日志，但是保存并新建没有查看日志，所以需要排除新建是自己的记录）。
            //operatetype: 1、新建 	  2、修改	4、查看
            str = " and not exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+ relatedkey +" and t3.operateuserid="+user.getUID()+" and t3.operatetype = 4)"+
                    " and not exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+ relatedkey +" and t3.operatetype in(1,2) and t3.operateuserid="+user.getUID()+" and t3.id = " +
                    nullFun+"((select max(id) id from  "+tablename+" t4 where t1."+primarykey+"=t4."+ relatedkey +" and t4.operatetype in(1,2)),0)) ";
        }else if("2".equals(enabled)){
            //修改记录的ID大于本人最后一次查看记录的ID，并且存在本人查看记录
            str = " and exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+relatedkey+" and t3.operatetype = 2 and t3.id >" +
                    nullFun+"((select max(id) id from "+tablename+" t4 where t1."+primarykey+"=t4."+relatedkey+" and t4.operateuserid="+user.getUID()+" and t4.operatetype=4),0)) " +
                    "and exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+relatedkey+" and t3.operateuserid="+user.getUID()+" and t3.operatetype = 4) ";
        }else if("3".equals(enabled)){
            //不存在修改记录大于查看记录，并且存在查看记录，并且需要自己修改、新建的记录
            str = " and ((not exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+relatedkey+" and t3.operatetype in(1,2) and t3.id > " +
                    nullFun+"((select max(id) id from "+tablename+" t4 where t1."+primarykey+"=t4."+relatedkey+" and t4.operateuserid="+user.getUID()+" and t4.operatetype=4),0)) " +
                    "and exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+relatedkey+" and t3.operateuserid="+user.getUID()+" and t3.operatetype = 4)) " +
                    "or exists (select 1 from "+tablename+" t3 where t1."+primarykey+"=t3."+relatedkey+" and t3.operatetype in(1,2) and t3.operateuserid="+user.getUID()+" and t3.id = " +
                    nullFun+"((select max(id) id from "+tablename+" t4 where t1."+primarykey+"=t4."+relatedkey+" and t4.operatetype in(1,2)),0))) ";
        }
        return str;
    }

    /**
     * 判断是否查询过该条数据，如果没有查询过，则显示图标
     * @param modeid
     * @param formdataid
     * @param userid
     * @return 1：新建 2：修改 0:不显示
     */
    public int isNewimage(String modeid,String formdataid,int userid){
        int retint = 0;
        String tablename = "ModeViewLog_"+modeid;
        // CHANGE START
        String relatedkey = ShardingActionHelper.getRelatedKey(Integer.parseInt(modeid));
        // CHANGE END
        String sql ="select max(id) id ,operatetype,operateuserid  from "+tablename+" where "+relatedkey+"="+formdataid+" and operatetype in (1,2) group by operatetype,operateuserid order by id desc" ;
        RecordSet recordSet = new RecordSet();
        recordSet.executeSql(sql);
        // 新建、修改最后修改时间
        int lastid = 0;
        int operateuserid = 0;
        if(recordSet.next()){
            lastid = recordSet.getInt(1);
            operateuserid = recordSet.getInt(3);
        }
        //如果编辑、创建为当前操作者，则肯定查看过。由于ModedataOperation.jsp中，查看页面可以没有加载完，导致自己编辑的，还会显示new
        if(userid==operateuserid){
            retint = 0;
        }else{
            sql = "select 1 from "+tablename+" where "+relatedkey+"="+formdataid+"  and operateuserid="+userid+" and operatetype=4 and id>"+lastid;
            recordSet.executeSql(sql);
            if(!recordSet.next()){
                sql = "select 1 from "+tablename+" where "+relatedkey+"="+formdataid+"  and operateuserid="+userid+" and operatetype=4 ";
                recordSet.executeSql(sql);
                if(recordSet.next()){
                    retint = 2;
                }else{
                    retint = 1;
                }
            }
        }
        return retint;
    }

    /**
     * 获得转译后的sql
     * @param str
     * @return
     */
    public String toSqlForSplitPage(String s){
        s=Util.StringReplace(s,"\\'", "'");
        s=Util.StringReplace(s,"&lt;", "<");
        s=Util.StringReplace(s,"&gt;", ">");
        s=Util.StringReplace(s,"&amp;", "&");
        s=Util.StringReplace(s,"&quot;", "\"");

        return s;
    }

    /**
     * 获得固定搜索的sql
     * @param user	用户
     * @param defaultsql 默认搜索
     * @return
     */
    public String getDefaultSql(User user,String defaultsql){
        return getDefaultSql(user,"","",defaultsql);
    }

    /**
     * 获得固定搜索的sql
     * @param user	用户
     * @param thisdate 1本周,2本月,3本季,4本年
     * @param thisorg 1本部门,2本部门(包含下级部门),3本分部,4本分部(包含下级分部)
     * @param defaultsql 默认搜索
     * @return
     */
    public String getDefaultSql(User user,String thisdate,String thisorg,String defaultsql){
    	return new FormModeTransMethod().getDefaultSql(user, thisdate, thisorg, defaultsql);
    }

    /**
     * 获得固定字符串替换当前参数导名称
     * @param user	用户
     * @param defaultsql 固定字符串
     * @return
     */
    public String getDefaultSqlToName(User user,String defaultsql){
    	return new FormModeTransMethod().getDefaultSqlToName(user,  defaultsql);
    }

    public String changeSelectValue(int userid,int customid,String modedataid,String detailid,String fieldid,String fieldname,String showvalue,String fieldvalue,Map map){
        String style ="";
        showvalue = showvalue.replace("$"+fieldname+"$", "$Select-Name-"+fieldvalue+"$");
        if(map.containsKey("transColor")&&showvalue.indexOf("$Field-ID$")!=-1){
        	showvalue = showvalue.replace("$Field-ID$",fieldid);
        	showvalue = showvalue.replace("$Select-Value$",fieldvalue);
        	String transColor = StringHelper.null2String(map.get("transColor"));
        	if(!StringHelper.isEmpty(transColor)){
        		try {
					JSONObject jsonObject = JSONObject.fromObject(transColor);
					String borderradius = "";
					if(jsonObject.containsKey("border-radius")){
						borderradius = jsonObject.getString("border-radius");
						if(!StringHelper.isEmpty(borderradius)){
							style += "border-radius:"+borderradius+";";
						}
					}
					if(jsonObject.containsKey(fieldvalue)){
						JSONObject css = jsonObject.getJSONObject(fieldvalue);
						if(css.containsKey("color")){
							style += "color:"+css.getString("color")+";";
						}
						if(css.containsKey("background")){
							style += "background:"+css.getString("background")+";";
						}
						if(css.containsKey("border-color")){
							style += "border-color:"+css.getString("border-color")+";";
						}
					}
				} catch (Exception e) {
					new FormmodeLog().writeLog(e);
				}
        		
        	}
        }
        showvalue = showvalue.replace("$Select-Style$",style);
        return showvalue;
        
    }
        public String changeOtherFieldValue(int userid,int customid,String modedataid,String detailid,String fieldid,String fieldname,String showvalue){
        	String fieldvalue = "";
        String backfields = "";
        RecordSet rs = new RecordSet();
        RecordSet rs1 = new RecordSet();
        Map<String,String> fieldNameMap = new HashMap<>();
        String tmpshowvalue = showvalue;
        int beginIndex = showvalue.indexOf("$");
        boolean isDtField = false;
        String workformid = "";
        rs.executeQuery("select a.detailtable,a.billid from workflow_billfield  a where id=?",fieldid);
        while(rs.next()){
            String detailtable = Util.null2String(rs.getString("detailtable"));
            workformid = rs.getString("billid");
            if(detailtable.length()>0){
                isDtField = true;
            }
        }
        StringBuffer key= new StringBuffer();
        StringBuffer tmpField= new StringBuffer();
        StringBuffer tmpbackfields= new StringBuffer();

        if(beginIndex!=-1) {
            while (beginIndex > -1) {
                int endIndex = showvalue.indexOf("$", beginIndex + 1);
                if (endIndex > -1) {
                    String tmpFieldName = showvalue.substring(beginIndex + 1, endIndex);
                    tmpField.setLength(0);
                    // tmpField.append(tmpFieldName);
                    key.setLength(0);
                    key.append("\\$").append(FieldUtil.quoteReplacement(tmpFieldName)).append("\\$");
					//下拉框设置显示转换 特定字段不需要处理
					if(showvalue.contains("selectid_$Field-ID$")||showvalue.contains("select-value-$Select-Value$")||showvalue.contains("style=\"$Select-Style$\"")){
                        if(tmpFieldName.equalsIgnoreCase("Field-ID")||tmpFieldName.equalsIgnoreCase("Select-Value")||tmpFieldName.equalsIgnoreCase("Select-Style")){
                            showvalue = showvalue.replaceAll(key.toString(),"");
                            beginIndex = showvalue.indexOf("$");
                            continue;
                        }
                    }
					
                    if(fieldname.equals(tmpFieldName)||tmpFieldName.equals("fieldbackvalue")||tmpFieldName.equals("fieldfontvalue")){
                        //如果和当前字段一样就不取出来
                        showvalue = showvalue.replaceAll(key.toString(),"");
                        beginIndex = showvalue.indexOf("$");
                        continue;
                    }
                    showvalue = showvalue.replaceAll(key.toString(),"");
                    beginIndex = showvalue.indexOf("$");
                    //xk:支持t1.col[text]方法
                    String tmpFieldNameCol = tmpFieldName;
                    if (tmpFieldNameCol.contains("[text]")) {
                        tmpFieldNameCol = tmpFieldNameCol.replaceAll(FieldUtil.quoteReplacement("[text]"), "");
                    }
                    if(tmpFieldName.indexOf(".")==-1){
                        if(isDtField) {
                            fieldNameMap.put(tmpFieldName,"d1_"+tmpFieldNameCol);
                            tmpField.append("d1.").append(tmpFieldNameCol).append(" as  d1_").append(tmpFieldNameCol);
                           // tmpFieldName = "d1."+tmpFieldNameCol+" as d1_"+tmpFieldNameCol;
                        }else{
                            fieldNameMap.put(tmpFieldName,"t1_"+tmpFieldNameCol);
                            tmpField.append("t1.").append(tmpFieldNameCol).append(" as  t1_").append(tmpFieldNameCol);
                            //tmpFieldName = "t1."+tmpFieldNameCol+" as t1_"+tmpFieldNameCol;
                        }
                    }else{
                        String sourceFiled = tmpFieldNameCol.replaceAll("\\.","_");
                        fieldNameMap.put(tmpFieldName,sourceFiled);
                        tmpField.append(tmpFieldNameCol).append(" as ").append(sourceFiled);
                        //tmpFieldName = tmpFieldNameCol+" as "+sourceFiled;
                    }

                    //backfields+=","+tmpField.toString();
                     tmpbackfields.append(",").append(tmpField);
                }else{
                    this.formmodeLog.writeLog("参数错误！");
                    break;
                }
            }
        }
          backfields=tmpbackfields.toString();
        if(backfields.length()>0){
            backfields = backfields.substring(1);
        }else{
            return tmpshowvalue;
        }


        rs.executeQuery("select c.detailTable,b.tablename,c.formid from mode_customsearch c ,workflow_bill b  where c.formid=b.id and c.id=?",customid);
        boolean isDetailtable = false;
        String detailTable = "";
        String maintable = "";
        int formid = 0;
        if(rs.next()){
            detailTable = Util.null2String(rs.getString("detailTable"));
            maintable = Util.null2String(rs.getString("tablename"));
            formid = Util.getIntValue(rs.getString("formid"),0);
            if(Util.null2String(rs.getString("detailTable")).length()>0){
                isDetailtable = true;
            }
        }

        // CHANGE START
        String vprimarykey = "id";
        String vdatasource = "";
        boolean isNumberPK = true;
        String formBizId = modedataid;
        String suffix = "";
        Integer modeid = ShardingActionHelper.getCustomSearchMode(customid);
        boolean isModeSharding = modeid != null && ShardingActionHelper.isModeSharding(modeid);
        if (isModeSharding) {
//            vdatasource = ShardingHelper.SHARDING_POOL_NAME;
            suffix = ShardingActionHelper.getShardingSuffix(modedataid);
            modedataid = ShardingActionHelper.extractBillId(formBizId);
        }
        // CHANGE END
        if(VirtualFormHandler.isVirtualForm(formid)){	//虚拟表单
            Map<String, Object> vFormInfo = VirtualFormHandler.getVFormInfo(formid);
            if(Util.null2String(vFormInfo.get("vformtype")).equals("2")){
            	maintable = modeFormComInfo.getVsql(formid);
            }else{            	
            	maintable = VirtualFormHandler.getRealFromName(maintable);
            }
            vprimarykey = Util.null2String(vFormInfo.get("vprimarykey"));
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
            rs.executeQuery("select * from workflow_billfield where billid=? and upper(fieldname)=?",formid,vprimarykey.toUpperCase());
            if(rs.next()){
                String vpkdbtype = Util.null2String(rs.getString("fielddbtype"));
                if(vpkdbtype.indexOf("(")>-1){
                    vpkdbtype = vpkdbtype.substring(0,vpkdbtype.indexOf("("));
                }
                TransMethodConfigAdd tmca = new TransMethodConfigAdd(null,null);
                isNumberPK = tmca.isNumberField(vpkdbtype);
            }
        }
        // CHANGE START
        String checksql = "";
        if(isDetailtable){
            if(Util.getIntValue(detailid,0)>0) {
                checksql = " select " + backfields + " from " + maintable + suffix + "  t1, " + detailTable + suffix + "  d1 where t1." + vprimarykey + " = d1.mainid  and d1.id=" + detailid;
            }else{
                checksql = " select " + backfields + " from " + maintable + suffix + " t1 where 1=1  ";
                if(isNumberPK){
                    checksql+= " and t1."+vprimarykey+"="+modedataid;
                }else{
                    checksql+= " and t1."+vprimarykey+"='"+modedataid+"'";
                }
            }
        }else{
            checksql = " select " + backfields + " from " + maintable + suffix + "  t1 where 1=1 ";
            if(isNumberPK){
                checksql+= "and t1."+vprimarykey+"="+modedataid;
            }else{
                checksql+= "and t1."+vprimarykey+"='"+modedataid+"'";
            }
        }
        // CHANGE END

        if(vdatasource.equals("")){
            rs1.execute(checksql);
        }else{
            rs1.executeSql(checksql,vdatasource);
        }
        if(rs1.next()){
            Iterator it = fieldNameMap.keySet().iterator();
            while(it.hasNext()){
                String Key = Util.null2String(it.next());
                String Value = Util.null2String(fieldNameMap.get(Key));
                String sourceValue = Util.null2String(rs1.getString(Value));
                sourceValue = CubeCipherUitl.decrypt(sourceValue);
                sourceValue = getSpecialValue(Key, sourceValue, workformid, new User(userid), rs);//xk:支持t1.col[text]方法
                tmpshowvalue=this.handlePercentage(tmpshowvalue, sourceValue, Key);
                tmpshowvalue = tmpshowvalue.replaceAll("\\$" + FieldUtil.quoteReplacement(Key) + "\\$", sourceValue);
            }
        }else{
            Iterator it = fieldNameMap.keySet().iterator();
            while(it.hasNext()){
                String Key = Util.null2String(it.next());
                tmpshowvalue=this.handlePercentage(tmpshowvalue, "", Key);
                tmpshowvalue = tmpshowvalue.replaceAll("\\$" + FieldUtil.quoteReplacement(Key) + "\\$", "");
            }
        }
        return tmpshowvalue;
    }

    /**
     * 转换显示
     * @param customid
     * @param fieldid
     * @param fieldname
     * @param fieldvalue
     * @param returnStr
     * @return
     */
    public String changeShowmethod(int customid,String fieldid,String fieldvalue,String fieldvaluedes,String param){
        return this.changeShowmethod(customid,fieldid,fieldvalue,fieldvaluedes,param,null);
    }
    
    public Map<String,String> changeShowmethod2(int userid,int customid,String modedataid,String detailid,String fieldid,String fieldvalue,String fieldvaluedes,String param,Map<String,String> showMethodMap){
    		return this.changeShowmethod2(userid,customid,modedataid,detailid,fieldid,fieldvalue,fieldvaluedes,param,showMethodMap,null);
	}


    public Map<String,String> changeShowmethod2(int userid,int customid,String modedataid,String detailid,String fieldid,String fieldvalue,String fieldvaluedes,String param,Map<String,String> showMethodMap,Map selectMap){
        boolean issumcolumn = false;
        String paraTwoold = param;
        if(param.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            param = param.replace("+$issumcolumn$","");
        }
        Map<String,String> showmethodParamMap = null;
        showmethodParamMap =  this.checkcondition(userid,customid,modedataid,detailid,fieldid,param,fieldid);
        String fieldname = "";
        String fieldhtmltype = "";
        String type = "";
        RecordSet rs = new RecordSet();
        String fieldsql = "select * from workflow_billfield where id="+fieldid;
        rs.executeQuery(fieldsql);
        if(rs.next()){
            fieldname = rs.getString("fieldname");
            fieldhtmltype = rs.getString("fieldhtmltype");
            type = rs.getString("type");
        }
        String retstr =Util.null2String(fieldvalue);
        if(showmethodParamMap!=null) {
            String fieldshowvalue = Util.null2String(showmethodParamMap.get("fieldshowvalue"));
            fieldshowvalue = StringToDBC(fieldshowvalue);
            String fieldbackvalue = Util.null2String(showmethodParamMap.get("fieldbackvalue"));
            String fieldfontvalue = Util.null2String(showmethodParamMap.get("fieldfontvalue"));

            fieldshowvalue = this.getDefaultSql(new User(userid),fieldshowvalue);//动态参数转换
            if(fieldhtmltype.equals("5")){
            	if(!StringHelper.isEmpty(fieldvalue)){
            		if(selectMap!=null){
            			String selectname = StringHelper.null2String(selectMap.get(fieldvalue));
            			fieldshowvalue = fieldshowvalue.replace("$"+fieldname+"$", selectname);
            		}
            		fieldshowvalue = this.changeSelectValue(userid,customid,modedataid,detailid,fieldid,fieldname,fieldshowvalue,fieldvalue,showmethodParamMap);
            	}
            }
            fieldshowvalue = this.changeOtherFieldValue(userid,customid,modedataid,detailid,fieldid,fieldname,fieldshowvalue);
            fieldshowvalue = CubeCipherUitl.decrypt(fieldshowvalue);
            if("-1".equals(fieldid)){
                retstr = fieldvalue + " " + fieldvaluedes;
                retstr = Util.replaceString(fieldshowvalue, "$createdate$", fieldvalue);
                retstr = Util.replaceString(retstr, "$createtime$", fieldvaluedes);
                retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+this.convertNull2HTML(retstr)+"</span>";
            }else if(!"-1".equals(fieldid)&&"3".equals(fieldhtmltype)&&"2".equals(type)){
                retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
                retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+retstr+"</span>";
            }else if(!"-1".equals(fieldid)&&"1".equals(fieldhtmltype)&&!"1".equals(type)){
                if(type.equals("2") || type.equals("3")){
                    if(fieldshowvalue.indexOf("Amount(") > -1){ //金额大写
                        fieldvaluedes = "".equals(fieldvaluedes)?fieldvaluedes:NumToChinese(fieldvaluedes);
                        retstr = Util.replaceString(fieldshowvalue, "Amount($"+fieldname+"$)", fieldvaluedes);
                        fieldshowvalue =retstr;
                    }
                    if(fieldshowvalue.indexOf("Thousands(") > -1){  // 金额千分位转换
                        fieldvaluedes = changeToThousands(fieldvaluedes);
                        retstr = Util.replaceString(fieldshowvalue, "Thousands($"+fieldname+"$)", fieldvaluedes);
                        fieldshowvalue =retstr;
                    }
                    //xk:获取日期差
                    String dayInterv= DaysFuc(fieldshowvalue);
                    if (StringUtils.isNotEmpty(dayInterv)) {
                        retstr = Util.replaceString(dayInterv, "$" + fieldname + "$", fieldvaluedes);
                        fieldshowvalue = retstr;
                    }
                }
                if(issumcolumn){
                    //return retstr;
                    showmethodParamMap.put("retstr",retstr);
                    return showmethodParamMap;
                }
                retstr=this.handlePercentage(fieldshowvalue, fieldvaluedes, fieldname);//百分比
            } else if ("5".equals(fieldhtmltype)) {
//                if (!"".equals(fieldvaluedes)) {
                    retstr = Util.replaceString(fieldshowvalue, "$" + fieldname + "$", fieldvaluedes);
                    retstr = Util.replaceString(retstr, "$fieldbackvalue$", fieldbackvalue);
                    retstr = Util.replaceString(retstr, "$fieldfontvalue$", fieldfontvalue);
//                }
            } else if (("1".equals(fieldhtmltype) && "1".equals(type)) ) {//xk:获取日期差 支持普通文本
                String dayInterv= DaysFuc(fieldshowvalue);
                if (StringUtils.isNotEmpty(dayInterv)) {
                    retstr = Util.replaceString(dayInterv, "$" + fieldname + "$", fieldvaluedes);
                }else {
                    retstr = Util.replaceString(fieldshowvalue, "$" + fieldname + "$", fieldvaluedes);
                }
            } else if("2".equals(fieldhtmltype)){//多行文本
                retstr = Util.replaceString(fieldshowvalue, "$" + fieldname + "$", fieldvalue);
                retstr = retstr.replaceAll("\n", "<br/>");
                retstr = "<span><p>"+retstr+"</p></span>";
            }else{
                // 处理建模查询中心显示转换
                if (fieldshowvalue.indexOf("$" +fieldname + "$")>-1){
                    fieldvaluedes = fieldvalue;
                }
                retstr = Util.replaceString(fieldshowvalue, "$" + fieldname + "$", fieldvaluedes);
            }
            if("2".equals(fieldhtmltype)&&"1".equals(type)){
                if(!"".equals(fieldbackvalue)||!"".equals(fieldfontvalue)) {
                    retstr = retstr.replaceAll("<p>", "<p style='background-color:" + fieldbackvalue + ";" + "color:" + fieldfontvalue + ";'>");
                }
            }else {
                if("".equals(fieldbackvalue)&&"".equals(fieldfontvalue)){
                    retstr = convertNull2HTML(retstr);
                }else {
                    if("5".equals(fieldhtmltype)){
                        if(!retstr.equals("")){
                            if(retstr.indexOf("csBorderRadiusRed")==-1&&retstr.indexOf("csBorderRadiusGold")==-1){
                                retstr = "<span style='background-color:" + fieldbackvalue + ";" + "color:" + fieldfontvalue + ";'>" + convertNull2HTML(retstr) + "</span>";
                            }
                        }
                    }else{
                        if(retstr.indexOf("csBorderRadiusRed")==-1&&retstr.indexOf("csBorderRadiusGold")==-1){
                            retstr = "<span style='background-color:" + fieldbackvalue + ";" + "color:" + fieldfontvalue + ";'>" + convertNull2HTML(retstr) + "</span>";
                        }
                    }
                }
            }
        }else{
            showmethodParamMap = new HashMap<>();
            if("-1".equals(fieldid)){
                retstr = fieldvalue + " " + fieldvaluedes;
            }else if("5".equals(fieldhtmltype)) {
            	if(selectMap!=null&&selectMap.containsKey(fieldvalue)){
            		retstr = selectMap.get(fieldvalue) + " ";
            	}else{
            		retstr = fieldvaluedes;
            	}
            }else if(!"-1".equals(fieldid)&&"1".equals(fieldhtmltype)&&!"1".equals(type)) {
                retstr = fieldvaluedes;
            }else{
                retstr = fieldvaluedes;
            }
        }
        //if(retstr.indexOf("#BARCodeImg#")>-1){
        //    String[] tempStr = Util.splitString(param, "+");
        //    int pcount = tempStr.length-21;//添加处理虚拟表单主键字段含有加号的逻辑，
        //    if(pcount>0){
        //        modedataid = "";
        //        for (int i = 0; i < pcount+1; i++) {
        //            modedataid += "+"+tempStr[i];
        //        }
        //        modedataid = modedataid.substring(1);
        //    }else{
        //        pcount=0;
        //    }
        //    CustomSearchComInfo customSearchComInfo = new CustomSearchComInfo();
        //    String formmodeid =customSearchComInfo.getModeId(Util.null2String(customid));
        //    String formID = customSearchComInfo.getFormId(Util.null2String(customid));
        //    retstr = retstr.replaceAll("#BARCodeImg#","<img src='/weaver/weaver.formmode.servelt.BARcodeBuildAction?modeid="+formmodeid+"&formid="+formID+"&billid="+modedataid+"&customid="+customid+"'>");
        //}
        showmethodParamMap.put("retstr",retstr);
        return showmethodParamMap;
    }
    
    /**
     * 进度条处理
     * @param fieldshowvalue 要转化的str
     * @param fieldvalue 字段值
     * @param fieldname	字段名
     * @return
     */
    private String handlePercentage (String fieldshowvalue,String fieldvalue,String fieldname){
    	String retstr=fieldshowvalue;
    	if(fieldshowvalue.indexOf("Percentage(") > -1){ //百分比
        	if ("".equals(fieldvalue)) {
        		retstr = fieldshowvalue.replace("Percentage($"+fieldname+"$)</span>", "</span>");
        		if(retstr.indexOf("cube-list-progress")!=-1){
                    retstr = retstr.replace("Percentage($"+fieldname+"$)", "0%");//#894609概述：解决了数值类型字段设置显示转换为百分比，数值为空时改为显示空值的问题
                    retstr = retstr.replace("$"+fieldname+"$%", "0%");
                }else{
                    retstr = retstr.replace("Percentage($"+fieldname+"$)", "");//#894609概述：解决了数值类型字段设置显示转换为百分比，数值为空时改为显示空值的问题
                    retstr = retstr.replace("$"+fieldname+"$%", "");
                }

			}else {
				fieldvalue=fieldvalue.replace(",", "");
				BigDecimal bigDecimal=BigDecimal.ZERO;
				try {
					bigDecimal = new BigDecimal(fieldvalue);
				} catch (Exception e) {
					new BaseBean().writeLog(e);
				}
				bigDecimal=bigDecimal.multiply(new BigDecimal(100));
				fieldvalue = bigDecimal.stripTrailingZeros().toPlainString();
				if(fieldshowvalue.indexOf("ant-progress-bg")>-1&&Util.getDoubleValue(fieldvalue)<0){
                    fieldshowvalue = fieldshowvalue.replaceFirst("Percentage\\(\\$"+fieldname+"\\$\\)", "0%");
                }
				retstr = Util.replaceString(fieldshowvalue, "Percentage($"+fieldname+"$)", fieldvalue+"%");
				retstr = Util.replaceString(retstr, "$"+fieldname+"$", fieldvalue);
			}
        }else {
        	if ("".equals(fieldvalue)&&fieldshowvalue.indexOf("cube-list-progress")!=-1) {
        		retstr = fieldshowvalue.replace("$"+fieldname+"$%</span>", "</span>");
        		retstr = retstr.replace("$"+fieldname+"$%", "0%");
			}else{
				//显示转化设置常量,这里会被置空,先去掉
//                if("".equals(fieldvalue)){
//                    fieldshowvalue = "";
//                }
                if(fieldshowvalue.indexOf("ant-progress-bg")>-1&&Util.getDoubleValue(fieldvalue)<0){
                    fieldshowvalue = fieldshowvalue.replaceFirst("\\$"+fieldname+"\\$", "0");
                }
				retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvalue);
			}
		}
    	return retstr;
    }

    /**
     * 全角转半角
     * @param str
     * @return
     */
    public String StringToDBC(String str) {
        char[] c = str.toCharArray();
        for (int i = 0; i < c.length; i++) {
            if (c[i] == 12288) {
                //全角空格为12288，半角空格为32
                c[i] = (char) 32;
                continue;
            }
            if (c[i] > 65280 && c[i] < 65375)
                //其他字符半角(33-126)与全角(65281-65374)的对应关系是：均相差65248
                c[i] = (char) (c[i] - 65248);
        }
        return new String(c);
    }

    /**
     * 转换显示的条件
     * @param customid
     * @param fieldid
     * @return
     */
    public Map<String,String> checkcondition(int userid,int customid,String modedataid,String detailid,String fieldid,String param,String paramfieldid){
        RecordSet rs = new RecordSet();
        RecordSet rs1 = new RecordSet();
        rs.executeQuery("select c.detailTable,b.tablename,c.formid from mode_customsearch c ,workflow_bill b  where c.formid=b.id and c.id=?",customid);
         boolean isDetailtable = false;
        String detailTable = "";
        String maintable = "";
        int formid = 0;
        if(rs.next()){
            detailTable = Util.null2String(rs.getString("detailTable"));
            maintable = Util.null2String(rs.getString("tablename"));
            formid = Util.getIntValue(rs.getString("formid"),0);
            if(Util.null2String(rs.getString("detailTable")).length()>0){
                isDetailtable = true;
            }
        }

        String vprimarykey = "id";
        String vdatasource = "";
        boolean isNumberPK = true;
        // CHANGE START
        String formBizId = modedataid;
        String suffix = "";
        Integer modeid = ShardingActionHelper.getCustomSearchMode(customid);
        boolean isModeSharding = modeid != null && ShardingActionHelper.isModeSharding(modeid);
        if (isModeSharding) {
            suffix = ShardingActionHelper.getShardingSuffix(modedataid);
            modedataid = ShardingActionHelper.extractBillId(formBizId);
        }
        // CHANGE END
        if(VirtualFormHandler.isVirtualForm(formid)){	//虚拟表单
            Map<String, Object> vFormInfo = VirtualFormHandler.getVFormInfo(formid);
         //   maintable = VirtualFormHandler.getRealFromName(maintable);
            String vformtype = Util.null2String(vFormInfo.get("vformtype"));
            String vsql = Util.null2String(vFormInfo.get("vsql"));
            if("2".equals(vformtype)){
                maintable="("+vsql+") cube_vsql ";
            }else{
                maintable= VirtualFormHandler.getRealFromName(maintable);
            }
            vprimarykey = Util.null2String(vFormInfo.get("vprimarykey"));
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));
            rs.executeQuery("select * from workflow_billfield where billid=? and upper(fieldname)=?",formid,vprimarykey.toUpperCase());
            if(rs.next()){
                String vpkdbtype = Util.null2String(rs.getString("fielddbtype"));
                if(vpkdbtype.indexOf("(")>-1){
                    vpkdbtype = vpkdbtype.substring(0,vpkdbtype.indexOf("("));
                }
                TransMethodConfigAdd tmca = new TransMethodConfigAdd(null,null);
                isNumberPK = tmca.isNumberField(vpkdbtype);
            }
        }

        String sql  = "SELECT a.id,a.conditiontype,a.conditionsql,a.conditiontext,fieldshowvalue,fieldbackvalue,fieldfontvalue,rowbackvalue,rowfontvalue,transColor " +
                " FROM customfieldshowchange a " +
                " WHERE a.fieldid="+fieldid+" and a.customid="+customid+" order by a.id ";
        rs.execute(sql);
        while(rs.next()){
            String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
            String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
            String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
            String rowbackvalue = Util.null2String(rs.getString("rowbackvalue"));
            String rowfontvalue = Util.null2String(rs.getString("rowfontvalue"));
            String transColor = Util.null2String(rs.getString("transColor"));

            int conditionstype = Util.getIntValue(rs.getString("conditiontype"),0);
                String conditionsql = rs.getString("conditionsql");
            if(StringHelper.isEmpty(conditionsql)){
                Map<String,String> map = new HashMap<>();
                map.put("fieldshowvalue",fieldshowvalue);
                map.put("fieldbackvalue",fieldbackvalue);
                map.put("fieldfontvalue",fieldfontvalue);
                map.put("rowbackvalue",rowbackvalue);
                map.put("rowfontvalue",rowfontvalue);
                map.put("transColor",transColor);
                return map;
            }
            boolean iscreatedate = false;
            if("-1".equals(paramfieldid)){
                iscreatedate = true;
            }

            conditionsql = this.explainDateGetByCondtionSql(conditionsql,param,iscreatedate);
            FormModeTransMethod fmtm = new FormModeTransMethod();
            conditionsql = fmtm.getDefaultSql(new User(userid),conditionsql);
            String checksql ="";
            // CHANGE START
            if(isDetailtable){
                if(Util.getIntValue(detailid,0)>0) {
                    checksql = " select count(*) from " + maintable + suffix + " " + maintable + ", " + detailTable + suffix + " " + detailTable + " where " + maintable + "." + vprimarykey + " = " + detailTable + ".mainid and (" + conditionsql + ") and " + detailTable + ".id=" + detailid;
                }else{
                    checksql = " select count(*) from "+maintable+ suffix+ " " + maintable + " where 1=1 and ("+conditionsql+") " ;
                    if(isNumberPK){
                        checksql+= " and "+vprimarykey+"="+modedataid;
                    }else{
                        checksql+= " and "+vprimarykey+"='"+modedataid+"'";
                    }
                }
            }else{
                checksql = " select count(*) from "+maintable+ suffix+ " " + maintable + " where 1=1 and ("+conditionsql+") " ;
                if(isNumberPK){
                    checksql+= "and "+vprimarykey+"="+modedataid;
                }else{
                    checksql+= "and "+vprimarykey+"='"+modedataid+"'";
                }
            }
            // CHANGE END
            boolean flag = false;
            if(vdatasource.equals("")){
                flag = rs1.execute(checksql);
            }else{
                flag = rs1.executeSql(checksql,vdatasource);
            }
            if(flag&&rs1.next()){
                if(rs1.getInt(1)>0){
                    Map<String,String> map = new HashMap<>();
                    map.put("fieldshowvalue",fieldshowvalue);
                    map.put("fieldbackvalue",fieldbackvalue);
                    map.put("fieldfontvalue",fieldfontvalue);
                    map.put("rowbackvalue",rowbackvalue);
                    map.put("rowfontvalue",rowfontvalue);
                    map.put("transColor",transColor);
                    return map;
                }
            }

        }
        return null;
    }

    /**
     * 转换显示
     * @param customid
     * @param fieldid
     * @param fieldname
     * @param fieldvalue
     * @param returnStr
     * @return
     */
    public String changeShowmethod(int customid,String fieldid,String fieldvalue,String fieldvaluedes,String param,Map<String,String> curDataMap){

        RecordSet rs = new RecordSet();
        String retstr = Util.null2String(fieldvalue);
        boolean issumcolumn = false;
        String paraTwoold = param;
        if(param.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            param = param.replace("+$issumcolumn$","");
        }
        String fieldname = "";
        String fieldhtmltype = "";
        String type = "" ;

        String fieldsql = "select * from workflow_billfield where id="+fieldid;
        rs.executeSql(fieldsql);
        while(rs.next()){
            fieldname = rs.getString("fieldname");
            fieldhtmltype = rs.getString("fieldhtmltype");
            type = rs.getString("type");
        }
        //值为null，并且不是check框，直接返回
//        if("".equals(fieldvaluedes)&&(!"4".equals(fieldhtmltype)&&!("3".equals(fieldhtmltype)&&"2".equals(type)))){
//            return retstr;
//        }
        if("".equals(fieldvaluedes)){
            if("4".equals(fieldhtmltype)||"5".equals(fieldhtmltype)||("3".equals(fieldhtmltype)&&"2".equals(type))||("1".equals(fieldhtmltype)&&!"1".equals(type))){

            }else{
                return retstr;
            }
        }
        if("1".equals(fieldhtmltype)&&"5".equals(type)){
            fieldvalue = fieldvalue.replaceAll(",", "");
        }

        //日期类型
        if("-1".equals(fieldid)){
            retstr = fieldvalue + " " + fieldvaluedes;
            String currentdate = TimeUtil.getCurrentDateString();//		当前日期
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String _fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue"));
                String fieldoptvalue = explainDateGet(_fieldoptvalue,param,true);
                String _fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2"));
                String fieldoptvalue2 = explainDateGet(_fieldoptvalue2,param,true);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
                String displaystyles = Util.null2String(rs.getString("displaystyles"));

//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }

                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);

//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }

                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                //先替换$currentdate$，后比较
                boolean flag1 = true;
                boolean flag2 = true;

                if(fieldopt==7||fieldopt==8){//7为空  8不为空
                    boolean result = changeShowmethodNullOrNotNUll(fieldopt, fieldvalue);
                    flag1 = result;
                    flag2 = result;
                }else{
                    if(!"".equals(_fieldoptvalue)){
                        if(!"".equals(fieldoptvalue)){
                            flag1 = false;
                            /*int num = 0;
                            if(fieldoptvalue.indexOf("$currentdate$")>-1){
                                num = Util.getIntValue(fieldoptvalue.substring(fieldoptvalue.indexOf("$currentdate$")+"$currentdate$".length()),0);
                                fieldoptvalue = DateHelper.dayMove(currentdate, num);
                            }*/
                            long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue);
                            if(1==fieldopt){
                                if(day>0){
                                    flag1 =true;
                                }
                            }
                            if(2==fieldopt){
                                if(day>=0){
                                    flag1 =true;
                                }
                            }
                            if(5==fieldopt){
                                if(day==0){
                                    flag1 =true;
                                }
                            }
                            if(6==fieldopt){
                                if(day!=0){
                                    flag1 =true;
                                }
                            }
                        }else{
                            flag1 = false;
                        }
                    }
                    if(!"".equals(_fieldoptvalue2)){
                        if(!"".equals(fieldoptvalue2)){
                            flag2 = false;
                            /*int num = 0;
                            if(fieldoptvalue2.indexOf("$currentdate$")>-1){
                                num = Util.getIntValue(fieldoptvalue2.substring(fieldoptvalue2.indexOf("$currentdate$")+"$currentdate$".length()),0);
                                fieldoptvalue2 = DateHelper.dayMove(currentdate, num);
                            }*/
                            long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue2);
                            if(3==fieldopt2){
                                if(day<0){
                                    flag2 =true;
                                }
                            }
                            if(4==fieldopt2){
                                if(day<=0){
                                    flag2 =true;
                                }
                            }
                            if(5==fieldopt2){
                                if(day==0){
                                    flag2 =true;
                                }
                            }
                            if(6==fieldopt2){
                                if(day!=0){
                                    flag2 =true;
                                }
                            }
                        }else{
                            flag2 = false;
                        }
                    }
                    if("".equals(_fieldoptvalue)&&"".equals(_fieldoptvalue2)){
                        flag1 = false;
                        flag2 = false;
                    }
                }
                if(flag1&flag2){
                    retstr = Util.replaceString(fieldshowvalue, "$createdate$", fieldvalue);
                    retstr = Util.replaceString(retstr, "$createtime$", fieldvaluedes);
//                    retstr = this.convertFieldValue(retstr,curDataMap);
                    retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                }
            }
        }else if(!"-1".equals(fieldid)&&"3".equals(fieldhtmltype)&&"2".equals(type)){
            String currentdate = TimeUtil.getCurrentDateString();//		当前日期
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String _fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue"));
                String fieldoptvalue = explainDateGet(_fieldoptvalue,param,false);
                String _fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2"));
                String fieldoptvalue2 = explainDateGet(_fieldoptvalue2,param,false);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));

//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }
//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }
                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);
                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                //先替换$currentdate$，后比较
                boolean flag1 = true;
                boolean flag2 = true;

                if(!"".equals(_fieldoptvalue)){
                    if(!"".equals(fieldoptvalue)){
                        flag1 = false;
		    			/*int num = 0;
		    			if(fieldoptvalue.indexOf("$currentdate$")>-1){
		    				num = Util.getIntValue(fieldoptvalue.substring(fieldoptvalue.indexOf("$currentdate$")+"$currentdate$".length()),0);
		    				fieldoptvalue = DateHelper.dayMove(currentdate, num);
		    			}*/
                        long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue);
                        if(1==fieldopt){
                            if(day>0){
                                flag1 =true;
                            }
                        }
                        if(2==fieldopt){
                            if(day>=0){
                                flag1 =true;
                            }
                        }
                        if(5==fieldopt){
                            if(day==0){
                                flag1 =true;
                            }
                        }
                        if(6==fieldopt){
                            if(day!=0){
                                flag1 =true;
                            }
                        }
                    }else{
                        flag1 = false;
                    }
                }
                if(!"".equals(_fieldoptvalue2)){
                    if(!"".equals(fieldoptvalue2)){
                        flag2 = false;
		    			/*int num = 0;
		    			if(fieldoptvalue2.indexOf("$currentdate$")>-1){
		    				num = Util.getIntValue(fieldoptvalue2.substring(fieldoptvalue2.indexOf("$currentdate$")+"$currentdate$".length()),0);
		    				fieldoptvalue2 = DateHelper.dayMove(currentdate, num);
		    			}*/
                        long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue2);
                        if(3==fieldopt2){
                            if(day<0){
                                flag2 =true;
                            }
                        }
                        if(4==fieldopt2){
                            if(day<=0){
                                flag2 =true;
                            }
                        }
                        if(5==fieldopt2){
                            if(day==0){
                                flag2 =true;
                            }
                        }
                        if(6==fieldopt2){
                            if(day!=0){
                                flag2 =true;
                            }
                        }
                    }else{
                        flag2 = false;
                    }
                }
                if("".equals(_fieldoptvalue)&&"".equals(_fieldoptvalue2)){
                    flag1 = false;
                    flag2 = false;
                }
                
                if(8==fieldopt&&!StringHelper.isEmpty(fieldvalue)){
                	flag1 = true;
                	flag2 = true;
                } 

                if(flag1&flag2){
                    retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                    retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                    retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+retstr+"</span>";
                }
                
                if(7==fieldopt&&StringHelper.isEmpty(fieldvalue)){
                	retstr ="<div style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";width:50%;height:18px;max-width:68px;'></div>";
                }
            }
        }else if(!"-1".equals(fieldid)&&"1".equals(fieldhtmltype)&&!"1".equals(type)){
            retstr = fieldvaluedes;
            float value =  Util.getFloatValue(fieldvalue);
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue")).trim();
                String fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2")).trim();
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
                int displaystyles = Util.getIntValue(rs.getString("displaystyles"),0);
//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("\\$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }
//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("\\$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }
                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);
                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                boolean flag1 = true;
                boolean flag2 = true;

                if(fieldopt==7||fieldopt==8){//7为空  8不为空
                    boolean result = changeShowmethodNullOrNotNUll(fieldopt, fieldvalue);
                    flag1 = result;
                    flag2 = result;
                }else{
                    if (!"".equals(fieldoptvalue)) {
                        flag1 = false;
                        if (1 == fieldopt) {
                            if (value > Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (2 == fieldopt) {
                            if (value >= Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (5 == fieldopt) {
                            if (value == Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (6 == fieldopt) {
                            if (value != Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                    }
                    if (!"".equals(fieldoptvalue2)) {
                        flag2 = false;

                        if (3 == fieldopt2) {
                            if (value < Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (4 == fieldopt2) {
                            if (value <= Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (5 == fieldopt2) {
                            if (value == Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (6 == fieldopt2) {
                            if (value != Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                    }
                }

                if(flag1&flag2){
                    retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                    retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                    if(type.equals("2") || type.equals("3")){
                        if(fieldshowvalue.indexOf("Amount(") > -1){ //金额大写
                            fieldvaluedes = "".equals(fieldvaluedes)?fieldvaluedes:NumToChinese(fieldvaluedes);
                            retstr = Util.replaceString(fieldshowvalue, "Amount($"+fieldname+"$)", fieldvaluedes);
                        }
                        if(fieldshowvalue.indexOf("Thousands(") > -1){  // 金额千分位转换
                            fieldvaluedes = changeToThousands(fieldvaluedes);
                            retstr = Util.replaceString(fieldshowvalue, "Thousands($"+fieldname+"$)", fieldvaluedes);
                        }
                    }
                    if(issumcolumn){
                        return retstr;
                    }
//                    样式1：
//                    <div class="csProgressBar"><div style="width:$obj2$%;"><span>$obj2$%</span></div></div>
//                    样式2：
//                    <div class="csProgressBar csProgressBarGold"><div style="width:$jd$%;"><span>$jd$%</span></div></div>
//                    样式3：
//                    <div class="csProgressBar csProgressBarRed"><div style="width:$jd$%;"><span>$jd$%</span></div></div>

                    if(displaystyles==1){
                        retstr = "<div class=\"csProgressBar\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
                    }else if(displaystyles==2){
                        retstr = "<div class=\"csProgressBar csProgressBarGold\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
                    }else if(displaystyles==3){
                        retstr = "<div class=\"csProgressBar csProgressBarRed\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
                    }
                    retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                }
            }
        }else{
            retstr = fieldvaluedes;
            float value =  Util.getFloatValue(fieldvalue);
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                //int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt"),-1);
                float fieldoptvalue = Util.getFloatValue(rs.getString("fieldoptvalue"),0);
                //float fieldoptvalue2 = Util.getFloatValue(rs.getString("fieldoptvalue2"),0);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
                if(fieldopt==1)	{
                    if(value>fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                if(fieldopt==2)	{
                    if(value>=fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                if(fieldopt==3)	{
                    if(value<fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                if(fieldopt==4)	{
                    if(value<=fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                if(fieldopt==5)	{
                    //选择框
                    if("4".equals(fieldhtmltype)){
                        if("".equals(fieldvalue)){
                            value = 0;
                        }
                    }
                    if(value==fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                if(fieldopt==6)	{
                    if(value!=fieldoptvalue){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }

                //下拉框为空
                if(fieldopt==7)	{
                    if(value==-1){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
                //下拉框不为空
                if(fieldopt==8)	{
                    if(value!=-1){
                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap,true);
                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                    }
                }
            }
        }

        //System.out.println("retstr:"+retstr);
        return retstr;
    }



    private String explainDateGet(String explainStr,String param,boolean iscreatedate){
        String result = Util.null2String(explainStr);
        String startStr = "GetDate(";
        int startIndex = result.indexOf(startStr);
        if(startIndex>-1){
            startIndex += startStr.length();
            int endIndex = result.indexOf(")");
            if(endIndex>-1&&endIndex>startIndex){
                String str1 = result.substring(startIndex,endIndex);
                String[] strValues = str1.split(",",-1);
                if(strValues!=null&&strValues.length==4){
                    String date = strValues[0];
                    date = explainDate(date, param,iscreatedate);
                    int year = Util.getIntValue(explainDate(strValues[1], param,iscreatedate),0);
                    int month = Util.getIntValue(explainDate(strValues[2], param,iscreatedate),0);
                    int day = Util.getIntValue(explainDate(strValues[3], param,iscreatedate),0);
                    date = dateMove(date, year, 1);
                    date = dateMove(date, month, 2);
                    date = dateMove(date, day, 3);
                    result = date;
                }
            }
            //System.out.println("explainDateGet======================="+result);
        }
        result = result.replace("$date$", DateHelper.getCurrentDate());
        if(DateHelper.parseDate(result)==null){
            result = "";
        }
        return result;
    }

    public String explainDateGetByCondtionSql(String conditionSql,String param,boolean iscreatedate){
        String result = Util.null2String(conditionSql);
        result =  this.getConvertGetDate(conditionSql,param,iscreatedate);
        return result;
    }


    private String explainDate(String str,String param,boolean iscreatedate){
        RecordSet RecordSet = new RecordSet();
        String result = "";
        str = Util.null2String(str);
        String startStr = "$";
        if(str.startsWith(startStr)&&str.endsWith(startStr)&&str.length()>2){
            String columnName = str.substring(1,str.length()-1);
            if("date".equals(columnName)){
                return DateHelper.getCurrentDate();
            }
            String tableName = "";
            int dtindex = columnName.indexOf(".");
            if(dtindex>-1){
                tableName = columnName.substring(0,dtindex);
                columnName = columnName.substring(dtindex+1,columnName.length());
            }
            if(param.indexOf("noshowmethod")>-1){
                param = param.replace("+noshowmethod", "");
            }
            String[] tempStr = Util.TokenizerString2(param, "+");
            String formID = "";
            String modedataid = "";
            if(iscreatedate){
                formID = Util.null2String(tempStr[4]);
                modedataid = Util.null2String(tempStr[3]);
            }else{
                formID = Util.null2String(tempStr[9]);
                modedataid = Util.null2String(tempStr[0]);
            }
            String colid = "id";
            String detailid = "";
            if("".equals(tableName)){
                String sqlStr = "select tablename from workflow_bill where id="+formID;
                RecordSet.executeSql(sqlStr);
                if(RecordSet.next()){
                    tableName = RecordSet.getString(1);
                }
            }else{
                colid = "id";
                if(param.indexOf("'")!=-1){
                    String[] strs = param.split("'");
                    String detailstr=strs[1];
                    String[] detail=Util.TokenizerString2(detailstr, "+");
                    //detailtablename=detail[1];
                    detailid=detail[0];
//                    paraTwo=strs[0];
//                    if(strs.length>2){
//                        String[] split = strs[2].split("\\+");
//                        if (split.length>2) {
//                            sliderPercentage = split[1];
//                            qfws=Util.getIntValue(split[2],2);
//                        }
//                    }
                }
                modedataid = detailid;
            }
            String vdatasource ="";
            boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formID);
			if(isVirtualForm){
				tableName = VirtualFormHandler.getRealFromName(tableName);
				String vprimarykeySql = "select vprimarykey,vdatasource from  modeformextend where formid="+formID;
    			RecordSet.executeSql(vprimarykeySql);
    			if(RecordSet.next()){
    				colid = RecordSet.getString("vprimarykey");
    				vdatasource = RecordSet.getString("vdatasource");
    			}
			}
			String sql = "select "+columnName+" from "+tableName+" where "+colid+"='"+modedataid+"'";
			if(vdatasource.equals("")){
				RecordSet.execute(sql);
			  }else{
				RecordSet.executeSql(sql,vdatasource);
			  }
            //RecordSet.execute("select "+columnName+" from "+tableName+" where "+colid+"="+modedataid);
            if(RecordSet.next()){
                String s = RecordSet.getString(1);
                result = Util.null2String(s);
            }
        }else{
            result = str;
        }
        return result;
    }

    private String dateMove(String date,int n,int type){
        String result = date;
        if(n==0){
            return result;
        }
        try{
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Date d = sdf.parse(date);
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(d);
            String[] arr = date.split("-");
            if(arr.length==3){
                switch (type) {
                    case 1:
                        calendar.add(Calendar.YEAR, n);
                        break;
                    case 2:
                        calendar.add(Calendar.MONTH, n);
                        break;
                    case 3:
                        calendar.add(Calendar.DAY_OF_MONTH, n);
                        break;
                    default:
                        break;
                }
                result = sdf.format(calendar.getTime());
            }
        }catch (Exception e) {
            //writeLog(e);
        }
        return result;
    }

    public Map customsearch(HttpServletRequest request, RecordSet rs, String customid, String maintableAlias, String detailtableAlias,
                            boolean isoracle, boolean isdb2, String vdatasourceDBtype, User user, String isbill, String modeid, String formID, int viewtype, Hashtable conht, String sqlwhere_con){
        Hashtable retmap = new Hashtable();
        while(rs.next()){
            String tmpid = ""+Util.null2String(rs.getString("id"));
            String tmpcolname = ""+Util.null2String(rs.getString("fieldname"));
            String htmltype =  ""+Util.null2String(rs.getString("fieldhtmltype"));
            String type =  ""+Util.null2String(rs.getString("type"));
            int field_viewtype= Util.getIntValue(Util.null2String(rs.getString("viewtype")));

            String tableAlias=maintableAlias;
            if(field_viewtype==1){
                tableAlias=detailtableAlias;
            }

            String searchparaname = ""+Util.null2String(rs.getString("searchparaname"));
            boolean tempflag = false;
            boolean tempflag1 = false;
            String tmpvalue = "";
            String tmpvalue1 = "";
            if(!"".equals(searchparaname)){
                tmpvalue = ""+Util.null2String(request.getParameter(searchparaname));
                if("".equals(tmpvalue)){
                    tempflag = true;
                }
            }else{
                tempflag = true;
            }
//    		 	System.out.println("tmpvalue:::"+tmpvalue);
            String searchparaname1 = ""+Util.null2String(rs.getString("searchparaname1"));
            if(!"".equals(searchparaname1)){
                tmpvalue1 = ""+Util.null2String(request.getParameter(searchparaname1));
                if("".equals(tmpvalue1)){
                    tempflag1 = true;
                }
            }else{
                tempflag1 = true;
            }

            if(tempflag&&tempflag1){
                continue;
            }
            String dbtype=""+Util.null2String(rs.getString("fielddbtype"));
            String istitle="0";
            String con_name = "";

            if(tmpid.equals("-1")){
                tmpid="_3";
                tmpcolname="modedatacreatedate";
                htmltype="3";
                type="2";
                dbtype="char(10)";
            }else if(tmpid.equals("-2")){
                tmpid="_4";
                tmpcolname="modedatacreater";
                htmltype="3";
                type="17";
                dbtype="varchar2(200)";
            }
            // url 参数获取 add by cjl 2016-03-28
            String datetype_opt = "";
            if(!"".equals(tmpvalue)){
                if(tmpvalue.indexOf("$") > -1){
                    String[] dataStr = replaceParam(user,tmpvalue,datetype_opt);
                    tmpvalue = dataStr[0];
                    tempflag = false;
                    tmpvalue1 = dataStr[1];
                    tempflag1 = false;
                    conht.put("datetype_"+tmpid+"_opt",dataStr[2]);
                }
            }
            String para3=tmpvalue+"+"+tmpvalue+"+"+htmltype+"+"+type+"+"+user.getLanguage()+"+"+isbill+"+"+dbtype+"+"+istitle+"+"+modeid+"+"+formID+"+"+viewtype;
            if(!tmpvalue.equals("")&&!tmpvalue.equals("NULL")){
                con_name = getOthersSearchname(tmpvalue,para3);
            }

            String tmpopt = "1";
            if((htmltype.equals("1")&& type.equals("1"))||htmltype.equals("2")){
                tmpopt = "3";
            }else if(htmltype.equals("1")&& !type.equals("1")){
                tmpopt = "2";
            }else if(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") )){
                tmpopt = "2";
            }

            String tmpopt1 = "";
            if((htmltype.equals("1")&& type.equals("1"))||htmltype.equals("2")){
                tmpopt1 = "4";
            }else if(htmltype.equals("1")&& !type.equals("1")){
                tmpopt1 = "4";
            }else if(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") )){
                tmpopt1 = "4";
            }else if(htmltype.equals("3") && type.equals("24")){
                tmpopt1 = "3";
            }



            conht.put("con_"+tmpid,"1");
            conht.put("con_"+tmpid+"_opt",tmpopt);
            conht.put("con_"+tmpid+"_opt1",tmpopt1);
            conht.put("con_"+tmpid+"_value",tmpvalue);
            conht.put("con_"+tmpid+"_value1",tmpvalue1);
            conht.put("con_"+tmpid+"_name",con_name);

            tmpvalue = tmpvalue.replace("'", "''");
            tmpvalue1 = tmpvalue1.replace("'", "''");
            if((htmltype.equals("1")&& type.equals("1"))||htmltype.equals("2")){  //文本框
                if(!tmpvalue.equals(""))
                {
                    if(tmpopt.equals("1"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" <>'"+tmpvalue +"' ";
                    if(tmpopt.equals("3")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        sqlwhere_con += " and (";
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " or "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                    if(tmpopt.equals("4")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " not like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                }
            } else if(htmltype.equals("1")&& !type.equals("1")){  //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                if(!tmpvalue.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else{//金额千分位是varchar类型
                            sqlwhere_con += "and (cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >"+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else{//金额千分位是varchar类型
                            sqlwhere_con += "and cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            } else if(htmltype.equals("4")){   //check类型 = !=
                sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                if(!tmpvalue.equals("1")) sqlwhere_con+="<>'1' ";
                else sqlwhere_con +="='1' ";
            } else if(htmltype.equals("5")){  //选择框   = !=
                int conditionTransition = rs.getInt("conditionTransition");
                if(conditionTransition==1){
                    String multiselectValue_tmpvalue = Util.null2String(tmpvalue);
                    conht.put("multiselectValue_con_"+tmpid+"_value",multiselectValue_tmpvalue);
                    if(!tmpvalue.equals("")){
                        sqlwhere_con += "and ( ";
                        String multiselectSqlwhere_con="";
                        String[] multiselectValue_tmpvalueArray  = multiselectValue_tmpvalue.split(",");
                        for(int n=0;n<multiselectValue_tmpvalueArray.length;n++){
                            if("".equals(multiselectValue_tmpvalueArray[n])){
                                continue;
                            }
                            multiselectSqlwhere_con+=tableAlias+"."+tmpcolname;
                            if(tmpopt.equals("1"))
                                multiselectSqlwhere_con+=" ="+multiselectValue_tmpvalueArray[n] +" or ";
                            if(tmpopt.equals("2"))
                                multiselectSqlwhere_con+=" <>"+multiselectValue_tmpvalueArray[n] +" or ";
                        }
                        if(multiselectSqlwhere_con.length()>0){
                            multiselectSqlwhere_con = multiselectSqlwhere_con.substring(0,multiselectSqlwhere_con.length()-3);
                        }
                        sqlwhere_con+=multiselectSqlwhere_con;
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }
                }else{

                    if(!tmpvalue.equals("")&&tmpvalue.indexOf(",")==-1){
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                        if(tmpvalue.equals("")) {
                            if(tmpopt.equals("1"))
                                sqlwhere_con+=" is null ";
                            if(tmpopt.equals("2"))
                                sqlwhere_con+=" is not  null ";
                        }
                        else{
                            if(tmpopt.equals("1"))
                                sqlwhere_con+=" ="+tmpvalue +" ";
                            if(tmpopt.equals("2"))
                                sqlwhere_con+=" <>"+tmpvalue +" ";
                        }
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }

//    		 				System.out.println(">>>>>sqlwhere_con:::"+sqlwhere_con);
                }
            } else if(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16"))){//浏览框单人力资源  条件为多人力 (int  not  in),条件为多文挡,条件为多部门,条件为多客户,条件为多项目,条件为多请求
                if(!tmpvalue.equals("")) {
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" in ("+tmpvalue +") ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not in ("+tmpvalue +") ";
                }
            }else if(htmltype.equals("3") && type.equals("24")){//职位的安全级别 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >"+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            }//职位安全级别end
            else if(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") )){    //日期 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >'"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >='"+tmpvalue +"' ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <'"+tmpvalue +"' ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <='"+tmpvalue +"' ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue +"' ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ='"+tmpvalue1+"' ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue1 +"' ";
                }
            }
            else if("3".equals(htmltype) && type.equals("141")){
                List<String> tmpvalueArray = null;
                if(FormModeBrowserUtil.isMultiBrowser(htmltype, type)) {
                    tmpvalueArray = Util.splitString2List(tmpvalue, "~");
                } else {
                    tmpvalueArray = new ArrayList<String>();
                    tmpvalueArray.add(tmpvalue);
                }
                sqlwhere_con += " and ( ";
                boolean first  = true;
                for(String _tmpvalue : tmpvalueArray) {
                    if(first) {
                        first = false;
                    } else {
                        sqlwhere_con += " and ";
                    }
                    if(vdatasourceDBtype.equalsIgnoreCase("oracle") || vdatasourceDBtype.equalsIgnoreCase("db2"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else if(vdatasourceDBtype.equals("mysql"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else if(vdatasourceDBtype.equals("postgresql"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else
                        sqlwhere_con += " CONVERT(varchar(max),"+tableAlias+"."+tmpcolname+") ";
                    if(tmpopt.equals("1"))	sqlwhere_con+=" like '%"+_tmpvalue +"%' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not like '%"+_tmpvalue +"%' ";
                }
            }
            else if (htmltype.equals("3") || htmltype.equals("6")){   //其他浏览框
                List<String> tmpvalueArray = null;
                if(FormModeBrowserUtil.isMultiBrowser(htmltype, type)) {
                    tmpvalueArray = Util.splitString2List(tmpvalue, ",");
                } else {
                    tmpvalueArray = new ArrayList<String>();
                    tmpvalueArray.add(tmpvalue);
                }
                sqlwhere_con += " and ( ";
                boolean first  = true;
                for(String _tmpvalue : tmpvalueArray) {
                    if(first) {
                        first = false;
                    } else {
                        sqlwhere_con += " and ";
                    }
                    if(vdatasourceDBtype.equalsIgnoreCase("oracle") || vdatasourceDBtype.equalsIgnoreCase("db2"))
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else if(vdatasourceDBtype.equals("mysql"))
                        sqlwhere_con += " CONCAT(',',"+tableAlias+"."+tmpcolname+",',') ";
                    else if(vdatasourceDBtype.equalsIgnoreCase("postgresql"))
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else
                        sqlwhere_con += " ','+CONVERT(varchar(max),"+tableAlias+"."+tmpcolname+")+',' ";
                    if(tmpopt.equals("1"))	sqlwhere_con+=" like '%,"+_tmpvalue +",%' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not like '%,"+_tmpvalue +",%' ";
                }

            }else if (htmltype.equals("8")){   //公共选择项
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpvalue.equals(""))
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" is null ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" is not  null ";
                    }
                    else
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" ="+tmpvalue +" ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                    }
                }else{
                    sqlwhere_con += "and ( 1=1 ";
                }
            }
            if (htmltype.equals("1")|| htmltype.equals("2")||(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16")))||(htmltype.equals("3") && type.equals("24"))||(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") ))) {
                if(!tmpvalue.equals("")){
                    sqlwhere_con +=") ";
                }
            }else{
                sqlwhere_con +=") ";
            }
        }
        retmap.put("sqlwhere_con", sqlwhere_con);
        retmap.put("conht",conht);
        return retmap;
    }

    public Map customsearch1(RecordSet rs,String customid,String maintableAlias,String detailtableAlias,boolean isoracle,boolean isdb2,String vdatasourceDBtype,Hashtable conht,String sqlwhere_con){
        Hashtable retmap = new Hashtable();
        while (rs.next()) {
            String tmpid = rs.getString("id");
            String tmpcolname = rs.getString("name");
            String htmltype = rs.getString("httype");
            String type = rs.getString("type");
            String tmpopt = rs.getString("topt");
            String tmpvalue = rs.getString("tvalue");
            String tmpname = rs.getString("tname");
            String tmpopt1 = rs.getString("topt1");
            String tmpvalue1 = rs.getString("tvalue1");
            int field_viewtype= rs.getInt("viewtype");
            String tableAlias=maintableAlias;
            if(field_viewtype==1){
                tableAlias=detailtableAlias;
            }
            if("".equals(tmpvalue)&&"".equals(tmpvalue1))continue;

            conht.put("con_"+tmpid,"1");
            conht.put("con_"+tmpid+"_opt",tmpopt);
            conht.put("con_"+tmpid+"_opt1",tmpopt1);
            conht.put("con_"+tmpid+"_value",tmpvalue);
            conht.put("con_"+tmpid+"_value1",tmpvalue1);
            conht.put("con_"+tmpid+"_name",tmpname);
            tmpvalue = tmpvalue.replace("'", "''");
            tmpvalue1 = tmpvalue1.replace("'", "''");
            if((htmltype.equals("1")&& type.equals("1"))||htmltype.equals("2")){  //文本框
                if(!tmpvalue.equals(""))
                {
                    if(tmpopt.equals("1"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" <>'"+tmpvalue +"' ";
                    if(tmpopt.equals("3")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        sqlwhere_con += " and (";
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " or "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                    if(tmpopt.equals("4")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " not like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                }
            } else if(htmltype.equals("1")&& !type.equals("1")){  //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                if(!tmpvalue.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else{//金额千分位是varchar类型
                            sqlwhere_con += "and (cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >"+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }else{//金额千分位是varchar类型
                            sqlwhere_con += "and cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            } else if(htmltype.equals("4")){   //check类型 = !=
                sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                if(!tmpvalue.equals("1")) sqlwhere_con+="<>'1' ";
                else sqlwhere_con +="='1' ";
            } else if(htmltype.equals("5")){  //选择框   = !=
                RecordSet  multiselectRs = new RecordSet();
                multiselectRs.executeSql("select conditionTransition from mode_CustomDspField where fieldid="+tmpid+" and customid="+customid);
                int conditionTransition = 0;
                if(multiselectRs.next()){
                    conditionTransition = multiselectRs.getInt("conditionTransition");
                }
                if(conditionTransition==1){
                    String multiselectValue_tmpvalue = "";
                    if(!tmpvalue.equals("")){
                        multiselectValue_tmpvalue = tmpvalue;
                        conht.put("multiselectValue_con_"+tmpid+"_value",multiselectValue_tmpvalue);
                        sqlwhere_con += "and ( ";
                        String multiselectSqlwhere_con="";
                        String[] multiselectValue_tmpvalueArray  = multiselectValue_tmpvalue.split(",");
                        for(int n=0;n<multiselectValue_tmpvalueArray.length;n++){
                            if("".equals(multiselectValue_tmpvalueArray[n])){
                                continue;
                            }
                            multiselectSqlwhere_con+=tableAlias+"."+tmpcolname;
                            if(tmpopt.equals("1"))
                                multiselectSqlwhere_con+=" ="+multiselectValue_tmpvalueArray[n] +" or ";
                            if(tmpopt.equals("2"))
                                multiselectSqlwhere_con+=" <>"+multiselectValue_tmpvalueArray[n] +" or ";
                        }
                        if(multiselectSqlwhere_con.length()>0){
                            multiselectSqlwhere_con = multiselectSqlwhere_con.substring(0,multiselectSqlwhere_con.length()-3);
                        }
                        sqlwhere_con+=multiselectSqlwhere_con;
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }
                }else{
                    if(!tmpvalue.equals("")&&tmpvalue.indexOf(",")==-1){
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                        if(tmpvalue.equals("")) {
                            if(tmpopt.equals("1"))	sqlwhere_con+=" is null ";
                            if(tmpopt.equals("2"))	sqlwhere_con+=" is not  null ";
                        }
                        else{
                            if(tmpopt.equals("1"))	sqlwhere_con+=" ="+tmpvalue +" ";
                            if(tmpopt.equals("2"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                        }
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }
                }
            } else if(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16"))){//浏览框单人力资源  条件为多人力 (int  not  in),条件为多文挡,条件为多部门,条件为多客户,条件为多项目,条件为多请求
                if(!tmpvalue.equals("")) {
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" in ("+tmpvalue +") ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not in ("+tmpvalue +") ";
                }
            }else if(htmltype.equals("3") && type.equals("24")){//职位的安全级别 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >"+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            }//职位安全级别end
            else if(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") )){    //日期 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >'"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >='"+tmpvalue +"' ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <'"+tmpvalue +"' ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <='"+tmpvalue +"' ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue +"' ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ='"+tmpvalue1+"' ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue1 +"' ";
                }
            }
            else if (htmltype.equals("3") || htmltype.equals("6")){   // 这些浏览框的逻辑相同合并到一起
                List<String> tmpvalueArray = null;
                if(FormModeBrowserUtil.isMultiBrowser(htmltype, type)) {
                    tmpvalueArray = Util.splitString2List(tmpvalue, ",");
                } else {
                    tmpvalueArray = new ArrayList<String>();
                    tmpvalueArray.add(tmpvalue);
                }
                sqlwhere_con += " and ( ";
                boolean first  = true;
                for(String _tmpvalue : tmpvalueArray) {
                    if(first) {
                        first = false;
                    } else {
                        sqlwhere_con += " and ";
                    }
                    if(vdatasourceDBtype.equalsIgnoreCase("oracle") || vdatasourceDBtype.equalsIgnoreCase("db2"))
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else if(vdatasourceDBtype.equals("mysql"))
                        sqlwhere_con += " CONCAT(',',"+tableAlias+"."+tmpcolname+",',') ";
                    else if(vdatasourceDBtype.equalsIgnoreCase("postgresql") )
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else
                        sqlwhere_con += " ','+CONVERT(varchar(max),"+tableAlias+"."+tmpcolname+")+',' ";
                    if(tmpopt.equals("1"))	sqlwhere_con+=" like '%,"+_tmpvalue +",%' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not like '%,"+_tmpvalue +",%' ";
                }
            } else if (htmltype.equals("8")){   //公共选择项
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpvalue.equals(""))
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" is null ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" is not  null ";
                    }
                    else
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" ="+tmpvalue +" ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                    }
                }else{
                    sqlwhere_con += "and ( 1=1 ";
                }
            }
            if (htmltype.equals("1")|| htmltype.equals("2")||(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16")))||(htmltype.equals("3") && type.equals("24"))||(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") ))) {
                if(!tmpvalue.equals("")){
                    sqlwhere_con +=") ";
                }
            }else{
                sqlwhere_con +=") ";
            }
        }
        retmap.put("sqlwhere_con", sqlwhere_con);
        retmap.put("conht",conht);
        return retmap;
    }

    public Map customsearch2(HttpServletRequest request,String[] checkcons,String maintableAlias,String detailtableAlias,boolean isoracle,boolean isdb2,String vdatasourceDBtype,Hashtable conht,String sqlwhere_con){
        Hashtable retmap = new Hashtable();
        String customid=Util.null2String(request.getParameter("customid").split("\\?")[0]);
        for(int i=0;checkcons!=null&&i<checkcons.length;i++){
            String tmpid = ""+checkcons[i];
            String tmpcolname = ""+Util.null2String(request.getParameter("con"+tmpid+"_colname"));
            String htmltype = ""+Util.null2String(request.getParameter("con"+tmpid+"_htmltype"));
            String type = ""+Util.null2String(request.getParameter("con"+tmpid+"_type"));
            String tmpopt = ""+Util.null2String(request.getParameter("con"+tmpid+"_opt"));
            String tmpvalue = ""+Util.null2String(request.getParameter("con"+tmpid+"_value"));
            String tmpname = ""+Util.null2String(request.getParameter("con"+tmpid+"_name"));
            String tmpopt1 = ""+Util.null2String(request.getParameter("con"+tmpid+"_opt1"));
            String tmpvalue1 = ""+Util.null2String(request.getParameter("con"+tmpid+"_value1"));
            int field_viewtype= Util.getIntValue(Util.null2String(request.getParameter("con"+tmpid+"_viewtype")));
            String tableAlias=maintableAlias;
            if(field_viewtype==1){
                tableAlias=detailtableAlias;
            }
            if("".equals(tmpvalue)&&"".equals(tmpvalue1))continue;
            conht.put("con_"+tmpid,"1");
            conht.put("con_"+tmpid+"_opt",tmpopt);
            conht.put("con_"+tmpid+"_opt1",tmpopt1);
            conht.put("con_"+tmpid+"_value",tmpvalue);
            conht.put("con_"+tmpid+"_value1",tmpvalue1);
            conht.put("con_"+tmpid+"_name",tmpname);
            tmpvalue = tmpvalue.replace("'", "''");
            tmpvalue1 = tmpvalue1.replace("'", "''");
            if((htmltype.equals("1")&& type.equals("1"))||htmltype.equals("2")){  //文本框
                if(!tmpvalue.equals(""))
                {
                    if(tmpopt.equals("1"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" and ("+tableAlias+"."+tmpcolname+" <>'"+tmpvalue +"' ";
                    if(tmpopt.equals("3")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        sqlwhere_con += " and (";
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " or "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                    if(tmpopt.equals("4")){
                        ArrayList tempvalues=Util.TokenizerString(Util.StringReplace(tmpvalue,"　"," ")," ");
                        for(int k=0;k<tempvalues.size();k++){
                            if(k==0) sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                            else  sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                            tmpvalue=Util.StringReplace(Util.StringReplace((String)tempvalues.get(k),"+","%"),"＋","%");
                            if(!isoracle&&!isdb2){
                                int indx=tmpvalue.indexOf("[");
                                if(indx<0) indx=tmpvalue.indexOf("]");
                                if(indx<0){
                                    sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                                }else{
                                    sqlwhere_con += " not like '%"+Util.StringReplace(Util.StringReplace(Util.StringReplace(tmpvalue,"/","//"),"[","/["),"]","/]")+"%' ESCAPE '/' ";
                                }
                            }else{
                                sqlwhere_con += " not like '%"+tmpvalue+"%' ";
                            }
                        }
                    }
                }
            } else if(htmltype.equals("1")&& !type.equals("1")){  //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                if(!tmpvalue.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and (cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else{//金额千分位是varchar类型
                            sqlwhere_con += "and (cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    if(type.equals("5")){//金额转换
                        if(vdatasourceDBtype.equals("oracle")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as number(30,6))";
                        }else if(vdatasourceDBtype.equals("mysql")){
                            sqlwhere_con += "and  cast((case when ifnull(("+tableAlias+"."+tmpcolname+" REGEXP '[0-9.,]'),0)=1 then replace("+tableAlias+"."+tmpcolname+",',','')  else '0' end) as  decimal(30,6) ) ";
                        }
                        else if(vdatasourceDBtype.equals("postgresql")){
                            sqlwhere_con += "and cast((CASE WHEN ("+tableAlias+"."+tmpcolname+"||'') is null THEN '0' WHEN ("+tableAlias+"."+tmpcolname+"||'') =' ' THEN '0' ELSE Replace(("+tableAlias+"."+tmpcolname+"||''), ',', '') END) as decimal(30,6))";
                        }
                        else{//金额千分位是varchar类型
                            sqlwhere_con += "and cast((CASE isnumeric ("+tableAlias+"."+tmpcolname+") WHEN 0 THEN '0' WHEN 1 THEN replace("+tableAlias+"."+tmpcolname+",',','') ELSE '0' END) as decimal(30,6))";
                        }
                    }else{
                        sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    }
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            } else if(htmltype.equals("4")){   //check类型 = !=
                sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                if(!tmpvalue.equals("1")) sqlwhere_con+="<>'1' ";
                else sqlwhere_con +="='1' ";
            } else if(htmltype.equals("5")){  //选择框   = !=
                RecordSet  multiselectRs = new RecordSet();
                multiselectRs.executeSql("select conditionTransition from mode_CustomDspField where fieldid="+tmpid+" and customid="+customid);
                int conditionTransition = 0;
                if(multiselectRs.next()){
                    conditionTransition = multiselectRs.getInt("conditionTransition");
                }
                if(conditionTransition==1){
                    String multiselectValue_tmpvalue = Util.null2String(request.getParameter("multiselectValue_con"+tmpid+"_value"));
                    if(!"".equals(multiselectValue_tmpvalue)){
                        tmpvalue = multiselectValue_tmpvalue;
                    }
                    conht.put("multiselectValue_con_"+tmpid+"_value",tmpvalue);
                    if(!tmpvalue.equals("")){
                        sqlwhere_con += "and ( ";
                        String multiselectSqlwhere_con="";
                        String[] multiselectValue_tmpvalueArray  = tmpvalue.split(",");
                        for(int n=0;n<multiselectValue_tmpvalueArray.length;n++){
                            if("".equals(multiselectValue_tmpvalueArray[n])){
                                continue;
                            }
                            multiselectSqlwhere_con+=tableAlias+"."+tmpcolname;
                            if(tmpopt.equals("1"))
                                multiselectSqlwhere_con+=" ="+multiselectValue_tmpvalueArray[n] +" or ";
                            if(tmpopt.equals("2"))
                                multiselectSqlwhere_con+=" <>"+multiselectValue_tmpvalueArray[n] +" or ";
                        }
                        if(multiselectSqlwhere_con.length()>0){
                            multiselectSqlwhere_con = multiselectSqlwhere_con.substring(0,multiselectSqlwhere_con.length()-3);
                        }
                        sqlwhere_con+=multiselectSqlwhere_con;
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }
                }else{
                    if(!tmpvalue.equals("")&&tmpvalue.indexOf(",")==-1){
                        sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                        if(tmpvalue.equals("")) {
                            if(tmpopt.equals("1"))	sqlwhere_con+=" is null ";
                            if(tmpopt.equals("2"))	sqlwhere_con+=" is not  null ";
                        }
                        else{
                            if(tmpopt.equals("1"))	sqlwhere_con+=" ="+tmpvalue +" ";
                            if(tmpopt.equals("2"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                        }
                    }else{
                        sqlwhere_con += "and ( 1=1 ";
                    }
                }
            } else if(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16"))){//浏览框单人力资源  条件为多人力 (int  not  in),条件为多文挡,条件为多部门,条件为多客户,条件为多项目,条件为多请求
                if(!tmpvalue.equals("")) {
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" in ("+tmpvalue +") ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not in ("+tmpvalue +") ";
                }
            }else if(htmltype.equals("3") && type.equals("24")){//职位的安全级别 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >"+tmpvalue +" ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >="+tmpvalue +" ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <"+tmpvalue +" ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <="+tmpvalue +" ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ="+tmpvalue +" ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >"+tmpvalue1 +" ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >="+tmpvalue1 +" ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <"+tmpvalue1 +" ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <="+tmpvalue1 +" ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ="+tmpvalue1+" ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>"+tmpvalue1 +" ";
                }
            }//职位安全级别end
            else if(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") )){    //日期 > >= = < !  and > >= = < !
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpopt.equals("1"))	sqlwhere_con+=" >'"+tmpvalue +"' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" >='"+tmpvalue +"' ";
                    if(tmpopt.equals("3"))	sqlwhere_con+=" <'"+tmpvalue +"' ";
                    if(tmpopt.equals("4"))	sqlwhere_con+=" <='"+tmpvalue +"' ";
                    if(tmpopt.equals("5"))	sqlwhere_con+=" ='"+tmpvalue +"' ";
                    if(tmpopt.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue +"' ";
                }
                if(!tmpvalue1.equals("")){
                    sqlwhere_con += " and "+tableAlias+"."+tmpcolname;
                    if(tmpopt1.equals("1"))	sqlwhere_con+=" >'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("2"))	sqlwhere_con+=" >='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("3"))	sqlwhere_con+=" <'"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("4"))	sqlwhere_con+=" <='"+tmpvalue1 +"' ";
                    if(tmpopt1.equals("5"))	sqlwhere_con+=" ='"+tmpvalue1+"' ";
                    if(tmpopt1.equals("6"))	sqlwhere_con+=" <>'"+tmpvalue1 +"' ";
                }
            }
            else if("3".equals(htmltype) && type.equals("141")){
                List<String> tmpvalueArray = null;
                if(FormModeBrowserUtil.isMultiBrowser(htmltype, type)) {
                    tmpvalueArray = Util.splitString2List(tmpvalue, "~");
                } else {
                    tmpvalueArray = new ArrayList<String>();
                    tmpvalueArray.add(tmpvalue);
                }
                sqlwhere_con += " and ( ";
                boolean first  = true;
                for(String _tmpvalue : tmpvalueArray) {
                    if(first) {
                        first = false;
                    } else {
                        sqlwhere_con += " and ";
                    }
                    if(vdatasourceDBtype.equalsIgnoreCase("oracle") || vdatasourceDBtype.equalsIgnoreCase("db2"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else if(vdatasourceDBtype.equals("mysql"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else if(vdatasourceDBtype.equals("postgresql"))
                        sqlwhere_con += " "+tableAlias+"."+tmpcolname+" ";
                    else
                        sqlwhere_con += " CONVERT(varchar(max),"+tableAlias+"."+tmpcolname+") ";
                    if(tmpopt.equals("1"))	sqlwhere_con+=" like '%"+_tmpvalue +"%' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not like '%"+_tmpvalue +"%' ";
                }
            }else if (htmltype.equals("3") || htmltype.equals("6")){   //其他浏览框
                List<String> tmpvalueArray = null;
                if(FormModeBrowserUtil.isMultiBrowser(htmltype, type)) {
                    tmpvalueArray = Util.splitString2List(tmpvalue, ",");
                } else {
                    tmpvalueArray = new ArrayList<String>();
                    tmpvalueArray.add(tmpvalue);
                }
                sqlwhere_con += " and ( ";
                boolean first  = true;
                for(String _tmpvalue : tmpvalueArray) {
                    if(first) {
                        first = false;
                    } else {
                        sqlwhere_con += " and ";
                    }
                    if(vdatasourceDBtype.equalsIgnoreCase("oracle") || vdatasourceDBtype.equalsIgnoreCase("db2"))
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else if(vdatasourceDBtype.equals("mysql"))
                        sqlwhere_con += " CONCAT(',',"+tableAlias+"."+tmpcolname+",',') ";
                    else if(vdatasourceDBtype.equalsIgnoreCase("postgresql"))
                        sqlwhere_con += " ','||"+tableAlias+"."+tmpcolname+"||',' ";
                    else
                        sqlwhere_con += " ','+CONVERT(varchar(max),"+tableAlias+"."+tmpcolname+")+',' ";
                    if(tmpopt.equals("1"))	sqlwhere_con+=" like '%,"+_tmpvalue +",%' ";
                    if(tmpopt.equals("2"))	sqlwhere_con+=" not like '%,"+_tmpvalue +",%' ";
                }
            } else if (htmltype.equals("8")){   //公共选择项
                if(!tmpvalue.equals("")){
                    sqlwhere_con += "and ("+tableAlias+"."+tmpcolname;
                    if(tmpvalue.equals(""))
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" is null ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" is not  null ";
                    }
                    else
                    {
                        if(tmpopt.equals("1"))	sqlwhere_con+=" ="+tmpvalue +" ";
                        if(tmpopt.equals("2"))	sqlwhere_con+=" <>"+tmpvalue +" ";
                    }
                }else{
                    sqlwhere_con += "and ( 1=1 ";
                }
            }
            if (htmltype.equals("1")|| htmltype.equals("2")||(htmltype.equals("3") && (type.equals("1")||type.equals("9")||type.equals("4")||type.equals("7")||type.equals("8")||type.equals("16")))||(htmltype.equals("3") && type.equals("24"))||(htmltype.equals("3") &&( type.equals("2") || type.equals("19") || type.equals("290") ))) {
                if(!tmpvalue.equals("")){
                    sqlwhere_con +=") ";
                }
            }else{
                sqlwhere_con +=") ";
            }
        }
        retmap.put("sqlwhere_con", sqlwhere_con);
        retmap.put("conht",conht);
        return retmap;
    }

    public String interceptHrefTitle(String source) {
        if(source == null || source.isEmpty()){
            return "";
        }
        String regex="<a.*?/a>";
        Pattern pt = Pattern.compile(regex);
        Matcher mt = pt.matcher(source);
        StringBuffer sb = new StringBuffer();
        while(mt.find()) {
            String regex2=">.*?</a>";
            Pattern pt2=Pattern.compile(regex2);
            Matcher mt2=pt2.matcher(mt.group());
            while(mt2.find()){
                sb.append(mt2.group().replaceAll(">|</a>","") + " ");
            }
        }
        return sb.toString();
    }

    public String[] replaceParam(User user, String datacondition,String datetype_opt){

        String[] datastr = new String[3];
        String datacondition1= "";
        datacondition = toSqlForSplitPage(datacondition);

        if(datacondition.indexOf("$")>-1){
//			当前操作者 $UserId$
//			当前操作者部门$DepartmentId$
//			当前操作者部门（包含下级部门）$AllDepartmentId$
//			当前操作者分部$SubcompanyId$
//			当前操作者分部（包含下级分部）$AllSubcompanyId$
//			当前日期$date$
//		    本周$ThisWeek$
//		    本月$ThisMonth$
//		    本季$ThisSeason$
//		    本年$ThisYear$
//		    上个月$LastMonth$
//		    上一年$LastYear$
            String userid = String.valueOf(user.getUID());//		当前操作者
            String userdepartmentid = String.valueOf(user.getUserDepartment());//		当前操作者部门
            String usersubcompanyid = String.valueOf(user.getUserSubCompany1());//		当前操作者分部

            String currentdate = TimeUtil.getCurrentDateString();//		当前日期

            int beginIndex = datacondition.indexOf("$");
            while(beginIndex>-1){
                int endIndex = datacondition.indexOf("$",beginIndex+1);
                if(endIndex>-1){
                    String substring = datacondition.substring(beginIndex+1, endIndex);
                    if(substring.equalsIgnoreCase("UserId")){
                        datacondition = datacondition.replace("$"+substring+"$", userid);
                    }else if(substring.equalsIgnoreCase("DepartmentId")){
                        datacondition = datacondition.replace("$"+substring+"$", userdepartmentid);
                    }else if(substring.equalsIgnoreCase("SubcompanyId")){
                        datacondition = datacondition.replace("$"+substring+"$", usersubcompanyid);
                    }else if(substring.equalsIgnoreCase("date")){ //今天
                        datacondition = datacondition.replace("$"+substring+"$", currentdate);
                        datacondition1  = datacondition;
                        datetype_opt = "1";
                    }else if(substring.equalsIgnoreCase("ThisWeek")){ //本周
                        String dates[] = getSearchDate("1");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "2";
                    }else if(substring.equalsIgnoreCase("ThisMonth")){//本月
                        String dates[] = getSearchDate("2");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "3";
                    }else if(substring.equalsIgnoreCase("LastMonth")){//上一月
                        String dates[] = getSearchDate("3");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "7";
                    }else if(substring.equalsIgnoreCase("ThisSeason")){//本季
                        String dates[] = getSearchDate("4");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "4";
                    }else if(substring.equalsIgnoreCase("ThisYear")){//本年
                        String dates[] = getSearchDate("5");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "5";
                    }else if(substring.equalsIgnoreCase("LastYear")){//上一年
                        String dates[] = getSearchDate("6");
                        datacondition = dates[0];
                        datacondition1 = dates[1];
                        datetype_opt = "8";
                    }else {
                        datacondition = datacondition.replaceFirst("\\$", "#+#");
                        datetype_opt = "6";
                    }
                    beginIndex = datacondition.indexOf("$");
                }else{
                    break;
                }
            }
        }
        datacondition = datacondition.replace("#+#", "$");
        datastr[0] = datacondition;
        datastr[1] = datacondition1;
        datastr[2] = datetype_opt;
        return datastr;
    }

    public String[] getSearchDate(String datetype) {
        String[] dateStr = new String[2];
        weaver.general.DateUtil du = new weaver.general.DateUtil();
        int valueType = Util.getIntValue(datetype, 0);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        switch(valueType) {
            case 1:
                //本周
                Calendar cal = Calendar.getInstance();
                cal.set(Calendar.DAY_OF_WEEK, cal.getActualMinimum(Calendar.DAY_OF_WEEK));//周日
                dateStr[0] = sdf.format(cal.getTime());
                cal.set(Calendar.DAY_OF_WEEK, cal.getActualMaximum(Calendar.DAY_OF_WEEK));//周六
                dateStr[1] =  sdf.format(cal.getTime());
                break;
            case 2:
                //本月
                dateStr[0] = sdf.format(du.getFirstDayOfMonth());
                dateStr[1] = sdf.format(du.getLastDayOfMonth());
                break;
            case 3:
                //上一月
                Date date = new Date();
                Calendar cDay = Calendar.getInstance();
                cDay.setTime(date);
                cDay.add(Calendar.MONTH, -1);
                cDay.set(Calendar.DAY_OF_MONTH, 1);
                dateStr[0] = sdf.format(cDay.getTime());
                Calendar calendar = Calendar.getInstance();
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.add(Calendar.DATE, -1);
                dateStr[1] = sdf.format(calendar.getTime());
                break;
            case 4:
                //本季
                dateStr[0] = sdf.format(du.getFirstDayOfQuarter());
                dateStr[1] = sdf.format(du.getLastDayOfQuarter());
                break;
            case 5:
                //本年
                dateStr[0] = du.getYearDateStart();
                dateStr[1] = du.getYearDateEnd();
                break;
            case 6:
                //上一年
                date = new Date();
                cDay = Calendar.getInstance();
                cDay.setTime(date);
                int year = cDay.get(Calendar.YEAR)-1;
                dateStr[0] = year + "-01-01";
                dateStr[1] = year + "-12-31";
                break;
            default:
                dateStr[0] = sdf.format(new Date());
                dateStr[1] = sdf.format(new Date());
                break;
        }

        return dateStr;
    }

    //判断url是否还有中文
    public boolean isChineseCharacter(String href){
        char[] charArray = href.toCharArray();
        for (int i = 0; i < charArray.length; i++) {
            if ((charArray[i] >= 0x4e00) && (charArray[i] <= 0x9fbb)) {
                //Java判断一个字符串是否有中文是利用Unicode编码来判断，
                // 因为中文的编码区间为：0x4e00--0x9fbb
                return true;
            }
        }
        return false;
    }

    /**
     *
     * @param fieldvalue
     * @param otherParam
     * @return
     */
    public String analyzeTitleFieldUrl(String fieldvalue,JSONObject otherParam){
        RecordSet rs = new RecordSet();
        String billid = Util.null2String(otherParam.get("billid"));
        String customid = Util.null2String(otherParam.get("customid"));
        String formmodeid = Util.null2String(otherParam.get("modeid"));
        String formID = Util.null2String(otherParam.get("formid"));
        String fieldid = Util.null2String(otherParam.get("fieldid"));
        String fieldhtmltype = Util.null2String(otherParam.get("fieldhtmltype"));
        String viewtype = Util.null2String(otherParam.get("viewtype"));
        String opentype = Util.null2String(otherParam.get("opentype"));
        String viewfrom = Util.null2String(otherParam.get("viewfrom"));
        int userid = Util.getIntValue(Util.null2String(otherParam.get("userid")),0);
        User user = new User(userid);        
        int enabled = Util.getIntValue(Util.null2String(otherParam.get("enabled")));
        String isenabled = Util.null2String(otherParam.get("isenabled"));
        String istitle = Util.null2String(otherParam.get("istitle"));
        String isportal = Util.null2String(otherParam.get("isportal"));
        String linkmode = Util.null2String(otherParam.get("linkmode"));
        String returnStr = fieldvalue;
        String modedataid = billid;
        if("0".equals(istitle))return returnStr;
        if(!"1".equals(fieldhtmltype) && !"5".equals(fieldhtmltype) && !"8".equals(fieldhtmltype))return returnStr;
        String tablename = "";
        String sqlStr = "select tablename from workflow_bill where id="+formID;
        rs.executeSql(sqlStr);
        if (rs.next()) {
            tablename = Util.null2String(rs.getString("tablename"));
        }
        String vdatasource = "";	//虚拟表单数据源
        String vprimarykey = "";	//虚拟表单主键列名称
        boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formID);	//是否是虚拟表单
        Map<String, Object> vFormInfo = new HashMap<String, Object>();
        if(isVirtualForm){
            vFormInfo = VirtualFormHandler.getVFormInfo(formID);
            vdatasource = Util.null2String(vFormInfo.get("vdatasource"));	//虚拟表单数据源
            vprimarykey = Util.null2String(vFormInfo.get("vprimarykey"));	//虚拟表单主键列名称
        }
        if(isVirtualForm){
            tablename = VirtualFormHandler.getRealFromName(tablename);
        }else{
            if(formmodeid.equals("0")&&!"".equals(tablename)){
                sqlStr = "select formmodeid from "+tablename+" where id="+billid;
                rs.executeSql(sqlStr);
                if(rs.next()){
                    formmodeid = Util.null2String(rs.getString("formmodeid"));
                }
            }
        }

        String hreflink="";
        String custmomfield = "select hreflink from Mode_CustomDspField where fieldid="+fieldid+" and customid="+customid;
        rs.executeSql(custmomfield);
        if (rs.next()) {
            hreflink = Util.null2String(rs.getString("hreflink"));
        }
        hreflink = Util.replaceString(hreflink, "$type$", viewtype);
        hreflink = Util.replaceString(hreflink, "$modeId$", formmodeid);
        hreflink = Util.replaceString(hreflink, "$formId$", formID);
        hreflink = Util.replaceString(hreflink, "$billid$", modedataid);
        hreflink = Util.replaceString(hreflink, "$opentype$", Util.null2String(opentype));
        hreflink = Util.replaceString(hreflink, "$customid$", Util.null2String(customid));
        hreflink = Util.replaceString(hreflink, "$viewfrom$", Util.null2String(viewfrom));

        String requestid = "0";

        if(isVirtualForm){
            String datesql ="select * from "+tablename +" where "+vprimarykey+"='"+modedataid+"'";
            rs.executeSql(datesql,vdatasource);
        }else{
            String datesql ="select * from "+tablename +" where id='"+modedataid+"'";
            rs.executeSql(datesql);
        }
        if(rs.next()){
            requestid = rs.getString("requestId");
            hreflink = Util.replaceString(hreflink, "$requestId$", requestid);
            RecordSet RecordSetfield = new RecordSet();
            String fieldsql = "select * from workflow_billfield where billid="+formID+" and (detailtable ='' or detailtable is null)";
            RecordSetfield.executeSql(fieldsql);
            while(RecordSetfield.next()){
                String fieldhtype = RecordSetfield.getString("fieldhtmltype");
                String type = RecordSetfield.getString("type");
                String fieldname = RecordSetfield.getString("fieldname");
                if("2".equals(fieldhtype)&&"2".equals(type)){
                    continue;
                }
                hreflink = Util.replaceString(hreflink, "$"+fieldname+"$", rs.getString(fieldname));
            }
        }

        String titleStr = Util.delHtml(returnStr);
        if(titleStr.indexOf("'")!=-1){
            titleStr = titleStr.replace("'", "%27");
        }
        if("1".equals(isportal)){//门户所需菜单链接
            if(linkmode.equals("2")){
                returnStr = "<a  href=javascript:modeopenFullWindowHaveBar(\""+hreflink+"\",\""+modedataid.trim()+"\")>"+returnStr+"</a> ";
            }else{
                returnStr = "<a  href='"+hreflink+"' target='_self'>"+returnStr+"</a>";
            }
        }else{
            if("1".equals(opentype)){
                //如果链接为空，默认表单链接
                if("".equals(hreflink)){
                    returnStr = "<a title='"+titleStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\""+weaver.general.GCONST.getContextPath()+"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+modedataid+"\")>"+returnStr+"</a> ";
                }else{
                    if(hreflink.indexOf("/workflow/request/ViewRequest.jsp")!=-1){
                        returnStr = "<a title='"+titleStr+"' href=javascript:modeopenFullWindowHaveBarForWFList(\""+hreflink+"\",\""+requestid+"\",\""+modedataid+"\")>"+returnStr+"</a> ";
                    }else{
                        hreflink +="&is_customized_link=true";
                        returnStr = "<a title='"+titleStr+"' href=javascript:parent.cubeOpenFullWindowBySelf(\""+hreflink+"\")>"+returnStr+"</a> ";
                    }
                }
            }else{
                if("".equals(hreflink)){
                    returnStr = "<a title='"+titleStr+"' href=javascript:modeopenFullWindowHaveBar(\""+weaver.general.GCONST.getContextPath()+"/formmode/view/AddFormMode.jsp?type="+viewtype+"&modeId="+formmodeid+"&formId="+formID+"&billid="+modedataid+"&opentype="+opentype+"&customid="+customid+"&viewfrom="+viewfrom+"\",\""+modedataid+"\")>"+returnStr+"</a> ";
                }else{
                    if(hreflink.indexOf("/workflow/request/ViewRequest.jsp")!=-1){
                        returnStr = "<a title='"+titleStr+"' href=javascript:modeopenFullWindowHaveBarForWFList(\""+hreflink+"\",\""+requestid+"\",\""+modedataid+"\")>"+returnStr+"</a> ";
                    }else{
                        returnStr = "<a title='"+titleStr+"' href=javascript:modeopenFullWindowHaveBar(\""+hreflink+"\",\""+modedataid.trim()+"\")>"+returnStr+"</a> ";
                    }

                }
            }

            //需要显示数据状态
            if("true".equals(isenabled)&&!isVirtualForm&&enabled!=-1){
                if(enabled==1){
                    returnStr +="<span id=\"span"+modedataid+"\"><img title='"+SystemEnv.getHtmlLabelName(83818, user.getLanguage())+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew_wev8.png\" complete=\"complete\"/></span>";//未读数据
                }else if(enabled==2){
                    returnStr +="<span id=\"span"+modedataid+"\"><img title='"+SystemEnv.getHtmlLabelName(83821, user.getLanguage())+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew2_wev8.png\" complete=\"complete\"/></span>";//反馈数据
                }else if(enabled==0){
                    //查询数据状态未选时，则需要判断数据状态
                    int isnewimage = isNewimage(formmodeid,modedataid,userid);
                    if(isnewimage==1){
                        returnStr +="<span id=\"span"+modedataid+"\"><img title='"+SystemEnv.getHtmlLabelName(83818, user.getLanguage())+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew_wev8.png\" complete=\"complete\"/></span>";//未读数据
                    }else if(isnewimage==2){
                        returnStr +="<span id=\"span"+modedataid+"\"><img title='"+SystemEnv.getHtmlLabelName(83821, user.getLanguage())+"' src=\""+weaver.general.GCONST.getContextPath()+"/images/ecology8/statusicon/BDNew2_wev8.png\" complete=\"complete\"/></span>";//反馈数据
                    }
                }
            }
        }
        return returnStr;
    }

    public  String toHtmlSearch(String s)
    {
        s = (s == null ? "" : s);
        String tempString=s;
        tempString = tempString.replaceAll("<p>","<br/>");
        tempString = tempString.replaceAll("</p>","<br/>");
        tempString = tempString.replaceAll("<script>initFlashVideo();</script>","");
        tempString = tempString.replaceAll("<br>","");
        tempString = tempString.replaceAll("\n","<br>");

        return tempString;
    }
    public String getShowName(JSONObject fieldObj, User user) {
        String fieldid = Util.null2String(fieldObj.get("fieldid"));
        String fieldname = Util.null2String(fieldObj.get("fieldname"));
        String detailtabletmp = Util.null2String(fieldObj.get("detailtable"));
        String fieldvalue = Util.null2String(fieldObj.get("fieldvalue"));

        int lastindex = fieldid.indexOf("_");
        lastindex = lastindex<0?fieldid.length():lastindex;
        String realFieldid = fieldid.substring(0,lastindex);

        RecordSet rs = new RecordSet();
        rs.executeQuery("select fielddbtype, fieldhtmltype, type from workflow_billfield where id = ? ", realFieldid);
        if(!rs.next()) {
            return fieldvalue;
        }

        String dbtype = Util.null2String(rs.getString("fielddbtype"));
        String fieldhtmltype = Util.null2String(rs.getString("fieldhtmltype"));
        String fieldtype = Util.null2String(rs.getString("type"));
        String returnStr="";

        try{
            if (fieldtype.equals("118")) {
                returnStr="<a href=\""+weaver.general.GCONST.getContextPath()+"/meeting/report/MeetingRoomPlan.jsp\" target=\"_blank\">"+SystemEnv.getHtmlLabelName(2193,user.getLanguage())+"</a>";
            }
            if(fieldhtmltype.equals("1") ){  // 单行
                if(fieldhtmltype.equals("1") && fieldtype.equals("4")){
                    //returnStr= Util.milfloatFormat(fieldvalue);
                    //returnStr = fieldvalue;
                    returnStr = Util.toDecimalDigits(fieldvalue,2);
                }else if(fieldtype.equals("3")||fieldtype.equals(5)){
                    int decimaldigits_t=2;
                    if(fieldtype.equals("3") && dbtype.indexOf(",") > -1){
                        decimaldigits_t = Util.getIntValue(dbtype.substring(dbtype.indexOf(",") + 1, dbtype.length() -1 ), 2);
                    }
                    BigDecimal b=new BigDecimal(fieldvalue);
                    b.setScale(decimaldigits_t,BigDecimal.ROUND_HALF_UP);
                    returnStr = Util.toDecimalDigits(b.toPlainString(), decimaldigits_t);
                    //double f1 = b.setScale(decimaldigits_t,BigDecimal.ROUND_HALF_UP).doubleValue();
                    //NumberFormat nf = NumberFormat.getInstance();
                    //returnStr = Util.toDecimalDigits(nf.format(f1)+"",decimaldigits_t);
                }else{
                    returnStr=  toHtmlSearch(fieldvalue);
                    returnStr = returnStr.replaceAll("<", "&lt;");
                    returnStr = returnStr.replaceAll(">", "&gt;");

                }

            }else if(fieldhtmltype.equals("2")){//多行文本框
                fieldvalue = Util.null2String(fieldvalue);
                String tempString=fieldvalue;
                if(fieldtype.equals("1")){
                    String[] tempFieldValue = fieldvalue.split("<p>|</p>|<script>initFlashVideo\\(\\);</script>|<br>");
                    for(int i=0;i<tempFieldValue.length;i++){
                        String temp = tempFieldValue[i].replaceAll("<", "&lt;");
                        temp = temp.replaceAll(">", "&gt;");
                        tempString = tempString.replace(tempFieldValue[i], temp);
                    }
                }


                tempString = tempString.replaceAll("<p>","<br/>");
                tempString = tempString.replaceAll("</p>","<br/>");
                tempString = tempString.replaceAll("<script>initFlashVideo();</script>","");
                tempString = tempString.replaceAll("<br>","</br></span><span>");
                //tempString = tempString.replaceAll("<br>","");
                String reg="[\u0000-\u001f|\ufffd|囧|]";
                try {
                    //tempString = Util.replace(tempString,reg,"",0);
                } catch (Exception e) {

                }
                returnStr = "<span>"+tempString+"</span>";
            }                                                          // 单行,多行文本框条件结束
            else if(fieldhtmltype.equals("3")){                         // 浏览按钮 (涉及workflow_broswerurl表)
                if(fieldtype.equals("2") || fieldtype.equals("19")){    // 日期和时间
                    returnStr=fieldvalue;
                } else if( fieldtype.equals("290") ){//时间日期
                    returnStr="".equals(Util.null2String(fieldvalue))?"":new DateTransformer().getLocaleDateTime(fieldvalue);  
                } else if(fieldtype.equals("224")||fieldtype.equals("225") ||fieldtype.equals("226")||fieldtype.equals("227")){
                    returnStr=fieldvalue;
                } else if(!fieldvalue.equals("")) {
                    String url=BrowserComInfo.getBrowserurl(fieldtype);     // 浏览按钮弹出页面的url
                    String showname = "";                                                   // 值显示的名称
                    String showid = "";                                                     // 值
                    String linkurl = "";
                    ArrayList tempshowidlist=Util.TokenizerString(fieldvalue,",");
                    RecordSet recordSet = new RecordSet();
                    if(fieldtype.equals("8") || fieldtype.equals("135")){
                        //项目，多项目
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=ProjectInfoComInfo1.getProjectInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("1") ||fieldtype.equals("17")||fieldtype.equals("165") ||fieldtype.equals("166")){
                        //人员，多人员
                        for(int k=0;k<tempshowidlist.size();k++){
                        	showname+="<a href=javaScript:openhrm("+tempshowidlist.get(k)+") onclick=pointerXY(event)>"+rc.getResourcename((String)tempshowidlist.get(k))+"</a>&nbsp;";
                        }
                    }else if(fieldtype.equals("7") || fieldtype.equals("18")){
                        //客户，多客户
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\""+linkurl+tempshowidlist.get(k)+"\" target=\"_new\">"+cci.getCustomerInfoname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=cci.getCustomerInfoname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("4") || fieldtype.equals("57")|| fieldtype.equals("167")|| fieldtype.equals("168")){
                        //部门，多部门
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+=DepartmentComInfo1.getDepartmentname((String)tempshowidlist.get(k))+"&nbsp;";
                            }else{
                                showname+=DepartmentComInfo1.getDepartmentname((String)tempshowidlist.get(k))+"&nbsp;";
                            }
                        }
                    }else if(fieldtype.equals("9") || fieldtype.equals("37")){
                        //文档，多文档
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";

                            {
                                if(!linkurl.equals("")){
                                    showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k))+"&nbsp;";
                                }else{
                                    showname+=DocComInfo1.getDocname((String)tempshowidlist.get(k))+"&nbsp;";
                                }
                            }
                        }
                    }else if(fieldtype.equals("23")){
                        //资产
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("") ){
                                showname+="<a href=\'"+linkurl+tempshowidlist.get(k)+"\' target=\'_new\'>"+CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname+=CapitalComInfo1.getCapitalname((String)tempshowidlist.get(k))+" ";
                            }
                        }
                    }else if(fieldtype.equals("16") || fieldtype.equals("152")|| fieldtype.equals("171")){
                        //相关请求
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(k>0) showname+="<br>";
                            if(!linkurl.equals("")){
                                int tempnum=0;
                                tempnum++;
                                showname+="<a href=\""+linkurl.replace("isrequest=1&","")+tempshowidlist.get(k)+"\" target=\"_new\">"+WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k))+"</a>";
                            }else{
                                showname+=WorkflowRequestComInfo1.getRequestName((String)tempshowidlist.get(k));
                            }
                        }
                    }else if(fieldtype.equals("141")){
                        //人力资源条件
                        showname+=rcm.getFormShowName(fieldvalue,user.getLanguage());
                    }
                    //added by alan for td:10814
                    else if(fieldtype.equals("142")) {
                        //收发文单位
                        for(int k=0;k<tempshowidlist.size();k++){
                            if(!linkurl.equals("")){
                                showname += "<a href='"+linkurl+tempshowidlist.get(k)+"' target='_new'>"+ duc.getReceiveUnitName(""+tempshowidlist.get(k))+"</a>&nbsp;";
                            }else{
                                showname += duc.getReceiveUnitName(""+tempshowidlist.get(k))+" ";
                            }
                        }
                    }
                    else if(fieldtype.equals("161")){//自定义单选
                        showname = "";                                   // 新建时候默认值显示的名称
                        String showdesc="";
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, showid,null);
                            String desc=Util.null2String(bb.getDescription());
                            String name=Util.null2String(bb.getName());
//							showname="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                            name = name.replaceAll("<", "&lt;");
                            name = name.replaceAll(">", "&gt;");
                            String href=Util.null2String(bb.getHref());
                            if(href.indexOf("/formmode/view/AddFormMode.jsp")!=-1){
                            	href = href.replace("/formmode/view/AddFormMode.jsp", "/spa/cube/index.html#/main/cube/card");
    						}
                            if(href.equals("")){
                                showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                            }else{
                                String tempcustomid = Util.null2String(browser.getCustomid());
                                href = new ButtonElement().getHrefByBrowser(tempcustomid, href, showid, recordSet);
                                if(isChineseCharacter(href)){
                                    showname+="<a title='"+desc+"' href='javascript:openHrefWithChinese(\""+href+"\");'>"+name+"</a>&nbsp;";
                                }else{
                                    showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                                }

                            }
                        }catch(Exception e){
                            e.printStackTrace();
                        }
                    }
                    else if(fieldtype.equals("162")){//自定义多选
                        showname = "";                                   // 新建时候默认值显示的名称
                        showid =fieldvalue;                                     // 新建时候默认值
                        try{
                            Browser browser=(Browser)StaticObj.getServiceByFullname(dbtype, Browser.class);
                            List l=Util.TokenizerString(showid,",");
                            for(int j=0;j<l.size();j++){
                                String curid=(String)l.get(j);
                                BrowserBean bb =BrowserValueInfoService.searchById_cube(browser, curid,null);
                                String name=Util.null2String(bb.getName());
                                ////System.out.println("showname:"+showname);
                                name = name.replaceAll("<", "&lt;");
                                name = name.replaceAll(">", "&gt;");
                                String desc=Util.null2String(bb.getDescription());
//							    showname+="<a title='"+desc+"'>"+name+"</a>&nbsp;";
                                String href=Util.null2String(bb.getHref());
                                if(href.equals("")){
                                    showname+="<span title='"+desc+"'>"+name+"</span>&nbsp;";
                                }else{
                                    String tempcustomid = Util.null2String(browser.getCustomid());
                                    href = new ButtonElement().getHrefByBrowser(tempcustomid, href, curid, recordSet);
                                    if(isChineseCharacter(href)){
                                        showname+="<a title='"+desc+"' href='javascript:openHrefWithChinese(\""+href+"\");'>"+name+"</a>&nbsp;";
                                    }else{
                                        showname+="<a title='"+desc+"' href='"+href+"' target='_blank'>"+name+"</a>&nbsp;";
                                    }
                                }
                            }
                        }catch(Exception e){
                        }
                    }else if (fieldtype.equals("256")||fieldtype.equals("257")) {//自定义树形单选
                        CustomTreeUtil customTreeUtil = new CustomTreeUtil();
                        showid = fieldvalue;
                        if(this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true") ){
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"onlyname");
                        }else{
                            showname = customTreeUtil.getTreeFieldShowName(fieldvalue,dbtype,"openByTreeField");
                        }

                    }else{
                        String tablename=BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                        String columname=BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                        String keycolumname=BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                        fieldvalue=deleteFirstAndEndchar(fieldvalue,",");
                        String sql ="";
                        if(fieldvalue.indexOf(",")!=-1){
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+" in( "+fieldvalue+")";
                        }
                        else {
                            sql= "select "+keycolumname+","+columname+" from "+tablename+" where "+keycolumname+"="+fieldvalue;
                        }
                        RecordSet RecordSet = new RecordSet();
                        RecordSet.executeSql(sql);
                        while(RecordSet.next()){
                            if(!linkurl.equals("") ){
                                showname += "<a href=\""+linkurl+RecordSet.getString(1)+"\" target=\"_new\">"+Util.toScreen(RecordSet.getString(2),user.getLanguage())+"</a>&nbsp;";
                            }else{
                                showname +=Util.toScreen(RecordSet.getString(2),user.getLanguage())+" ";
                            }
                        }    // end of while
                    }
                    returnStr=showname;
                }
            }                                                       // 浏览按钮条件结束
            else if(fieldhtmltype.equals("4")) {                    // check框
                returnStr=fieldvalue;
            }                                                       // check框条件结束
            else if(fieldhtmltype.equals("5")){                     // 选择框   select
                // 查询选择框的所有可以选择的值
                char flag = Util.getSeparator();
                rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+1);
                while(rs.next()){
                    String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                    String tmpselectname = Util.toScreen(rs.getString("selectname"),user.getLanguage());
                    if(fieldvalue.equals(tmpselectvalue)){
                        returnStr=tmpselectname;
                    }
                }
            }else if(fieldhtmltype.equals("6")){ //文档（附件）
                returnStr =   fieldvalue;
            }else if(fieldhtmltype.equals("8")){                     // 公共选择框   select
                // 查询选择框的所有可以选择的值
                rs.executeSql("select * from mode_selectitempagedetail where id='"+fieldvalue+"'");
                while(rs.next()){
        String tmpselectvalue = Util.null2String(rs.getString("id"));
        String tmpselectname = Util.toScreen(rs.getString("name"),user.getLanguage());
        if(fieldvalue.equals(tmpselectvalue)){
            returnStr=tmpselectname;
        }
    }
}
} catch (Exception e) {
        returnStr=fieldvalue;
        }


        return returnStr;
        }

    /**
     * 获取授权字段id
     */
    public List getAuthorizeFieldids(int modeid,int formid){
        List<String> authorizeFileids = new ArrayList<String>();
        RecordSet rs2 = new RecordSet();
        rs2.executeQuery("select a.*,b.fieldname,b.fielddbtype,b.fieldhtmltype,b.type,b.detailtable from ModeFieldAuthorize a, " +
                " workflow_billfield b where a.fieldid=b.id and b.billid =? and a.modeid=? and a.formid=? ",formid, modeid, formid);
        while(rs2.next()){
            String fieldid = rs2.getString("fieldid");
            authorizeFileids.add(fieldid);
        }
        return authorizeFileids;
    }
    

    //千分位转换
    public String changeToThousands(String value){
    	String fh = "";
		if (value.startsWith("-")) {
			value = value.substring(1);
			fh = "-";
		}
		
        String[] tempvalues = value.split("\\.");
        int precision = 0;
        if(tempvalues.length > 1){
            precision = tempvalues[1].length();
        }
        BigDecimal b = new BigDecimal(value);
        if(value.indexOf(".") == -1){
            String reg = "###,###";
            DecimalFormat d1 =new DecimalFormat(reg);
            value =  d1.format(b);
        }else{
            if(tempvalues[0].equals("0")){
                value= value;
            }else{
                if(tempvalues.length == 2){
                    precision = tempvalues[1].length();
                }
                String reg = "###,###.";
                for(int i=0;i<precision;i++){
                    reg += "0";
                }
                DecimalFormat d1 =new DecimalFormat(reg);
                value =  d1.format(b);
            }
        }
        return fh + value;
    }

    /**
     * 金额转换
     * 把金额阿拉伯数字转换为汉字表示，小数点后四舍五入保留两位
     *
     */
    public static String [] ChineseNum = new String[]{"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
    public String NumToChinese(String value){
        double num = 0;
        try{
            num = Double.parseDouble(value);
        }catch(Exception e){
            this.formmodeLog.writeLog(""+e);
        }

        if(num > 99999999999999.99 || num < -99999999999999.99)
            throw new IllegalArgumentException("参数值超出允许范围 (-99999999999999.99 ～ 99999999999999.99)！");
        boolean negative = false;//正负标号
        if(num<0){
            negative = true;
            num = num*(-1);
        }
        long temp = Math.round(num*100);
        int numFen=(int)(temp%10);//分
        temp=temp/10;
        int numJiao = (int)(temp%10);//角
        temp=temp/10;
        //此时temp只包含整数部分
        int [] parts =new int[20];//将金额整数部分分为在0-9999之间数的各个部分
        int numParts = 0;//记录把原来金额整数部分分割为几个部分
        for(int i=0;;i++){
            if(temp == 0)
                break;
            int part = (int)(temp%10000);
            parts[i] =part;
            temp = temp/10000;
            numParts++;
        }
        boolean beforeWanIsZero = true;//标志位，记录万的下一级是否为0
        String chineseStr = "";
        for(int i=0;i<numParts;i++){
            String partChinese = partConvert(parts[i]);
            if(i%2==0){
                if("".equals(partChinese))
                    beforeWanIsZero = true;
                else
                    beforeWanIsZero = false;
            }
            if(i!=0){
                if(i%2==0)//亿的部分
                    chineseStr = "亿"+chineseStr;
                else{
                    if("".equals(partChinese)&&!beforeWanIsZero)// 如果“万”对应的 part 为 0，而“万”下面一级不为 0，则不加“万”，而加“零”
                        chineseStr = "零"+chineseStr;
                    else{
                        if(parts[i-1]<1000&&parts[i-1]>0) {//如果万的部分不为0，而万前面的部分小于1000大于0，则万后面应该跟零
                            chineseStr = "零" + chineseStr;
                        }else if(parts[i-1]<10000000&&parts[i-1]>1000){
                            chineseStr = "万"+chineseStr;
                        }

                    }
                }
            }
            chineseStr = partChinese + chineseStr;
        }
        if(negative && StringHelper.isEmpty(chineseStr))//负数零  负几分几角
            chineseStr = "负" +chineseStr;
        else{
            if("".equals(chineseStr)){//整数部分为0，则表示为零元
                chineseStr = ChineseNum[0];
            }else if(negative){
                chineseStr = "负" +chineseStr;
            }
            chineseStr = chineseStr + "元";
        }
        if(numFen==0&&numJiao==0){
            chineseStr = chineseStr +"整";
        }else if(numFen==0){//0分
            chineseStr = chineseStr +ChineseNum[numJiao] + "角";
        }else{
            if(numJiao==0)
                chineseStr = chineseStr + "零" + ChineseNum[numFen] + "分";
            else
                chineseStr = chineseStr + ChineseNum[numJiao] + "角" + ChineseNum[numFen] + "分";
        }
        return chineseStr;
    }
    //转换拆分后的每个部分，0-9999之间
    public String partConvert(int partNum){
        if(partNum<0||partNum>10000){
            throw new IllegalArgumentException("参数必须是大于等于0或小于10000的整数");
        }
        String [] units = new String[]{"","拾","佰","仟"};
        int temp = partNum;
        String partResult = new Integer(partNum).toString();
        int partResultLength = partResult.length();
        boolean lastIsZero = true;//记录上一位是否为0
        String chineseStr = "";
        for(int i=0;i<partResultLength;i++){
            if(temp == 0)//高位无数字
                break;
            int digit = temp%10;
            if(digit == 0){
                if(!lastIsZero)//如果前一个数字不是0则在当前汉字串前加零
                    chineseStr = "零"+chineseStr;
                lastIsZero = true;
            }
            else{
                chineseStr = ChineseNum[digit] + units[i] +chineseStr;
                lastIsZero = false;
            }
            temp =temp/10;
        }
        return chineseStr;
    }

    public void newInstance() {
    }

    /**
     * 标签名称显示
     * @param tabids
     * @param modeid
     * @return
     */
    public String getTabName(String tabids, String parm) {
    	if("".equals(tabids)){
    		return "";
    	}
    	String[] tempStr = Util.TokenizerString2(parm, ":");
    	String modeid = tempStr[1];
    	RecordSet rs = new RecordSet();
    	SaveTabSet.createColIFNotExist("modeTabs_"+modeid);
    	String sql = "select id,tabname,color,bgcolor,bdcolor from modeTabs_"+modeid+" where id in ("+tabids+")";
    	rs.executeQuery(sql);
    	Map<String, JSONObject> map = new HashMap<String, JSONObject>();
    	while (rs.next()) {
			String tabname = Util.null2String(rs.getString("tabname"));
			String color = Util.null2String(rs.getString("color"));
			String bgcolor =Util.null2String(rs.getString("bgcolor"));
			String bdcolor = Util.null2String(rs.getString("bdcolor"));
			String tempcolor=color;
			color=tabTransMethod.getFontColor(tempcolor, bdcolor);
			bgcolor=tabTransMethod.getBgColor(bgcolor, tempcolor);
			bdcolor=tabTransMethod.getBdColor(bdcolor, tempcolor);
			String id = Util.null2String(rs.getString("id"));
			JSONObject obj  = new JSONObject();
			obj.put("tabname", tabname);
			obj.put("color", "#"+color);
			obj.put("bgcolor", "#"+bgcolor);
			obj.put("bdcolor", "#"+bdcolor);
			map.put(id, obj);
		}
    	JSONArray array = new JSONArray();
    	String result="";
    	for (String id : tabids.split(",")) {
			if (!"-1".equals(id)&&map.get(id)!=null) {
//				result+=map.get(id)+",";
				array.add(map.get(id));
			}
		}
        return array.toString();
    }

    /**
     * 草稿显示
     * @param fieldvalue 草稿状态 0正式 1草稿
     * @param parm 备用字段
     * @return
     */
    public String getModedatastatus(String fieldvalue,String parm){
//        String userid = parm;
//        ResourceComInfo rci = null;
//        try {
//            rci = new ResourceComInfo();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
        int language = Util.getIntValue(parm);
//        User user = new User(Integer.parseInt(userid));
        if("1".equals(fieldvalue)){//草稿
            return SystemEnv.getHtmlLabelName(220,language);
        }else{//正式
            return SystemEnv.getHtmlLabelName(15711,language);
        }
    }


    /**
     * 表单建模行样式设置字段
     * @param fieldvalue 需要转换的字段value
     * @param paraTwo paraTwo
     * @return
     */
    public String getFormmodeRowstyleColumn(String fieldvalue,String paraTwo){
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        String sql = "";
        boolean issumcolumn = false;
        String showchangefieldid = "";
        String rowstylefieldid = "";
        if(paraTwo.length()>0){
            String[] showchangeArray= paraTwo.split("_showchangesplit_");
            if(showchangeArray.length>2){
                paraTwo = showchangeArray[0];
                showchangefieldid = showchangeArray[1];
                rowstylefieldid = showchangeArray[2];
            }

        }
        String paraTwoold = paraTwo;
        if(paraTwo.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            paraTwo = paraTwo.replace("+$issumcolumn$","");
        }
        fieldvalue= fieldvalue.replace("weaver2017", "+");
        boolean isshowmethod = false;
        if(paraTwo.indexOf("noshowmethod")>-1){
            isshowmethod = true;
            paraTwo = paraTwo.replace("+noshowmethod", "");
        }
        String detailtablename = "";
        String detailid = "";
        //如果模块查询中包含有明细表 明细表的表面与明细数据id以+相连 以'与其他参数隔开 即 id+'+d_id+detailtable'
        if(paraTwo.indexOf("'")!=-1){
            String[] strs = paraTwo.split("'");
            String detailstr=strs[1];
            String[] detail=Util.TokenizerString2(detailstr, "+");
            detailtablename=detail[1];
            detailid=detail[0];
            paraTwo=strs[0];
        }
        String[] tempStr = Util.splitString(paraTwo, "+");
        String modedataid = Util.null2String(tempStr[0]);
        int pcount = tempStr.length-21;//添加处理虚拟表单主键字段含有加号的逻辑，
        if(pcount>0){
            modedataid = "";
            for (int i = 0; i < pcount+1; i++) {
                modedataid += "+"+tempStr[i];
            }
            modedataid = modedataid.substring(1);
        }else{
            pcount=0;
        }
        String fieldid = Util.null2String(tempStr[1+pcount]);
        String fieldhtmltype = Util.null2String(tempStr[2+pcount]);
        String fieldtype = Util.null2String(tempStr[3+pcount]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4+pcount]));
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5+pcount]);
        String dbtype = Util.null2String(tempStr[6+pcount]);
        String istitle = Util.null2String(tempStr[7+pcount]);
        if(issumcolumn){
            istitle = "0";
        }
        String formmodeid = Util.null2String(tempStr[8+pcount]);
        String formID = Util.null2String(tempStr[9+pcount]);
        String viewtype = Util.null2String(tempStr[10+pcount]);
        String ismaplocation ="";
        if(tempStr.length>11){
            ismaplocation= Util.null2String(tempStr[11+pcount]);
        }
        boolean isVirtualForm = "1".equals(modeFormComInfo.getIsVirtualForm(formID));
        String repordid = "";
        if(tempStr.length>=14) {
            repordid = Util.null2String(tempStr[13 + pcount]);
        }
        //this.formmodeLog.writeLog("行显示转换"+paraTwo);
        /**无权限列表处理*/
        String norightlist = customSearchComInfo.getNoRightList(repordid);
        String vdatasource = "";
        String vprimarykey = "id";
        if(isVirtualForm){
            vdatasource = Util.null2String(modeFormComInfo.getVDataSource(formID));
            vprimarykey = Util.null2String(modeFormComInfo.getVPrimaryKey(formID));	//主键列名称
        }
        int opentype = 0;
        String sliderPercentage = "";
        int customid = 0;
        String showmethod = "";
        int userid = 0;
        int enabled = -1;
        boolean isenabled = false;
        String viewfrom = "";//来源
        RecordSet recordSet = new RecordSet();
        String sqlStr = "";
        String tablename = workflowBillComInfo.getTablename(formID);
        if(isVirtualForm){
            tablename = VirtualFormHandler.getRealFromName(tablename);
        }
        String pageid = CubeUtil.getPageId(repordid);
        HashMap<String, HashMap<String, Object>> thisCache = cache.get(pageid);
        if(thisCache == null) {
            thisCache = new HashMap<String, HashMap<String, Object>>();
            cache.put(pageid, thisCache);
        }

        HashMap<String, Object> dataMap = thisCache.get("data");
        if(dataMap==null) {
            dataMap = new HashMap<String, Object>();
            thisCache.put("data", dataMap);
        }
        HashMap<String,String> curDataMap = (HashMap<String, String>) dataMap.get(modedataid);
        if(curDataMap==null) {
            curDataMap = new HashMap<String, String>();
            dataMap.put(modedataid, curDataMap);
            if (!StringHelper.isEmpty(tablename)) {
                sqlStr = "select * from "+tablename+" where "+vprimarykey+"= ? ";
                if("".equals(vdatasource)) vdatasource = null;
                RecordSet.executeSql(sqlStr, true, vdatasource, modedataid);
                String [] cols = RecordSet.getColumnName();
                if(RecordSet.next()){
                    for(String str :cols) {
                        curDataMap.put(str.toLowerCase(), RecordSet.getString(str));
                    }
                }
            }
        }
        HashMap<String, Object> detailDataMap = thisCache.get("detaildata");
        if(detailDataMap==null) {
            detailDataMap = new HashMap<String, Object>();
            thisCache.put("detaildata", detailDataMap);
        }
        HashMap<String,String> curDetailDataMap = (HashMap<String, String>) detailDataMap.get(detailid);
        //如果模块查询中含有明细表 查询出相应detaildid明细表的数据
        if (!StringHelper.isEmpty(detailtablename)&&!StringHelper.isEmpty(detailid)&&!detailid.equals(" ")) {
            if(curDetailDataMap==null) {
                detailDataMap.clear();
                curDetailDataMap = new HashMap<String, String>();
                detailDataMap.put(detailid, curDetailDataMap);
                sqlStr = "select * from "+detailtablename+" where id='"+detailid+"'";
                if("".equals(vdatasource)) vdatasource = null;
                RecordSet.executeSql(sqlStr, vdatasource);
                String [] cols = RecordSet.getColumnName();
                if(RecordSet.next()){
                    for(String str :cols) {
                        curDetailDataMap.put("dt."+str.toLowerCase(), RecordSet.getString(str));
                    }
                }
            }
        }

        if(formmodeid.equals("0")){
            formmodeid = Util.null2String(curDataMap.get("formmodeid"),"0");
        }else if(formmodeid.equals("virtual")){
            formmodeid = "0";
        }

        if(tempStr.length>14){
            opentype = Util.getIntValue(tempStr[12+pcount],0);
            customid = Util.getIntValue(tempStr[13+pcount],0);
            viewfrom = Util.null2String(tempStr[14+pcount]);
        }
        if(opentype == 2){
            if(tempStr.length==19){
                sliderPercentage = Util.null2String(tempStr[18+pcount]);
            }
        }
        if(tempStr.length>15){
            showmethod = Util.null2String(tempStr[15+pcount]);
        }

        isenabled = customSearchComInfo.getEnabled(customid+"");
        if(tempStr.length>16){
            userid = Util.getIntValue(tempStr[16+pcount]);
            enabled = Util.getIntValue(tempStr[17+pcount]);
        }

        if(isshowmethod){
            showmethod = "0";
        }
        String fieldname = "";
        fieldhtmltype = "";
        String type = "" ;
        String detailtable = "";

        if(curDetailDataMap!=null){
            curDataMap.putAll(curDetailDataMap);
        }

        String fieldsql = "select * from workflow_billfield where id="+fieldid;
        rs.executeSql(fieldsql);
        while(rs.next()){
            fieldname = rs.getString("fieldname");
            fieldhtmltype = rs.getString("fieldhtmltype");
            type = rs.getString("type");
            detailtable = rs.getString("detailtable");
        }
        if(detailtable.length()>0){
            fieldvalue = Util.null2String(curDataMap.get("dt."+fieldname.toLowerCase()));
        }else{
            fieldvalue = Util.null2String(curDataMap.get(fieldname.toLowerCase()));
        }
        String param = paraTwo;
        String[] showchangefieldidArray = showchangefieldid.split(",");
        if(showchangefieldidArray.length>0) {
            for(int i=0;i<showchangefieldidArray.length;i++) {
                String scfieldid =  Util.null2String(showchangefieldidArray[i]);
                if(scfieldid.length()>0) {
                    // 787001 TODO lb  #810110 恢复原先的显示逻辑
//                    RecordSet rsForCondition = new RecordSet();
//                    Map<String,String> showmethodParamMap = new HashMap<>();
//                    String sqlForCondition  = "SELECT a.id,a.conditiontype,a.conditionsql,a.conditiontext,fieldshowvalue,fieldbackvalue,fieldfontvalue,rowbackvalue,rowfontvalue " +
//                            " FROM customfieldshowchange a " +
//                            " WHERE a.fieldid="+fieldid+" and a.customid="+customid+" order by a.id ";
//                    rsForCondition.execute(sqlForCondition);
//                    while(rsForCondition.next()) {
//                        String conditionsql = Util.null2String(rs.getString("conditionsql"));
//                        if( "".equals(conditionsql) ){
//                            if( !("".equals(fieldvalue))  ){
//                                showmethodParamMap = this.checkcondition(userid, customid, modedataid, detailid, scfieldid, paraTwoold, rowstylefieldid);
//                            }
//                        }else{
//                            showmethodParamMap = this.checkcondition(userid, customid, modedataid, detailid, scfieldid, paraTwoold, rowstylefieldid);
//                        }
//
//                    }

                    Map<String, String> showmethodParamMap = this.checkcondition(userid, customid, modedataid, detailid, scfieldid, paraTwoold,rowstylefieldid);
                    if (showmethodParamMap != null) {
                        String rowbackvalue = Util.null2String(showmethodParamMap.get("rowbackvalue"));
                        String rowfontvalue = Util.null2String(showmethodParamMap.get("rowfontvalue"));
                        if(!"".equals(rowbackvalue)||!"".equals(rowfontvalue)){
                            return "{\"backgroundColor\":\"" + rowbackvalue + "\",\"color\":\"" + rowfontvalue + "\"}";
                        }
                    }
                }
            }
        }
        return "";
    }

    /**
     * 得到导出样式
     * @param showchangefieldid
     * @param userid
     * @param customid
     * @param modedataid
     * @param detailid
     * @param paraTwoold
     * @param rowstylefieldid
     * @return
     */
    public Map<String,String> getExportStyle(String showchangefieldid,int userid,int customid,String modedataid,String detailid,String paraTwoold,String rowstylefieldid){
        String[] showchangefieldidArray = showchangefieldid.split(",");
        if(showchangefieldidArray.length>0) {
            for(int i=0;i<showchangefieldidArray.length;i++) {
                String scfieldid =  Util.null2String(showchangefieldidArray[i]);
                if(scfieldid.length()>0) {
                    Map<String, String> showmethodParamMap = this.checkcondition(userid, customid, modedataid, detailid, scfieldid, paraTwoold,rowstylefieldid);
                    if (showmethodParamMap != null) {
                        String rowbackvalue = Util.null2String(showmethodParamMap.get("rowbackvalue"));
                        String rowfontvalue = Util.null2String(showmethodParamMap.get("rowfontvalue"));
                        String fieldfontvalue = Util.null2String(showmethodParamMap.get("fieldfontvalue"));
                        String fieldbackvalue = Util.null2String(showmethodParamMap.get("fieldbackvalue"));
                        Map<String,String> map = new HashMap<>();
                        if(!"".equals(rowfontvalue)){//整行字体颜色
                            map.put("contentfontcolor",rowfontvalue);
                        }
                        if(rowstylefieldid.equals(scfieldid)&&!"".equals(fieldfontvalue)){//单元格字体颜色
                            map.put("contentfontcolor",fieldfontvalue);
                        }
                        if(!"".equals(rowbackvalue)){//整行背景色
                            map.put("contentbg",rowbackvalue);
                        }
                        if(rowstylefieldid.equals(scfieldid)&&!"".equals(fieldbackvalue)){//单元格背景颜色
                            map.put("contentbg",fieldbackvalue);
                        }
                        if(map.size()>0){
                            return map;
                        }
                    }
                }
            }
        }
        return null;
    }

    /**
     * 表单建模行样式设置字段
     * @param fieldvalue 需要转换的字段value
     * @param paraTwo paraTwo
     * @return
     */
    public String getFormmodeRowstyleColumn2(String fieldvalue,String paraTwo){
        RecordSet rs = new RecordSet();
        RecordSet RecordSet = new RecordSet();
        String returnStr = "";
        String sql = "";
        boolean issumcolumn = false;
        String paraTwoold = paraTwo;
        if(paraTwo.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            paraTwo = paraTwo.replace("+$issumcolumn$","");
        }
        fieldvalue= fieldvalue.replace("weaver2017", "+");
        boolean isshowmethod = false;
        if(paraTwo.indexOf("noshowmethod")>-1){
            isshowmethod = true;
            paraTwo = paraTwo.replace("+noshowmethod", "");
        }
        String detailtablename = "";
        String detailid = "";
        //如果模块查询中包含有明细表 明细表的表面与明细数据id以+相连 以'与其他参数隔开 即 id+'+d_id+detailtable'
        if(paraTwo.indexOf("'")!=-1){
            String[] strs = paraTwo.split("'");
            String detailstr=strs[1];
            String[] detail=Util.TokenizerString2(detailstr, "+");
            detailtablename=detail[1];
            detailid=detail[0];
            paraTwo=strs[0];
        }
        String[] tempStr = Util.splitString(paraTwo, "+");
        String modedataid = Util.null2String(tempStr[0]);
        int pcount = tempStr.length-20;//添加处理虚拟表单主键字段含有加号的逻辑，
        if(pcount>0){
            modedataid = "";
            for (int i = 0; i < pcount+1; i++) {
                modedataid += "+"+tempStr[i];
            }
            modedataid = modedataid.substring(1);
        }else{
            pcount=0;
        }
        String fieldid = Util.null2String(tempStr[1+pcount]);
        String fieldhtmltype = Util.null2String(tempStr[2+pcount]);
        String fieldtype = Util.null2String(tempStr[3+pcount]);
        int userlanguage = Util.getIntValue(Util.null2String(tempStr[4+pcount]));
        char flag = Util.getSeparator();
        String isbill = Util.null2String(tempStr[5+pcount]);
        String dbtype = Util.null2String(tempStr[6+pcount]);
        String istitle = Util.null2String(tempStr[7+pcount]);
        if(issumcolumn){
            istitle = "0";
        }
        String formmodeid = Util.null2String(tempStr[8+pcount]);
        String formID = Util.null2String(tempStr[9+pcount]);
        String viewtype = Util.null2String(tempStr[10+pcount]);
        String ismaplocation ="";
        if(tempStr.length>11){
            ismaplocation= Util.null2String(tempStr[11+pcount]);
        }
        boolean isVirtualForm = "1".equals(modeFormComInfo.getIsVirtualForm(formID));
        String repordid = "";
        if(tempStr.length>=14) {
            repordid = Util.null2String(tempStr[13 + pcount]);
        }
        //this.formmodeLog.writeLog("行显示转换"+paraTwo);
        /**无权限列表处理*/
        String norightlist = customSearchComInfo.getNoRightList(repordid);
        String vdatasource = "";
        String vprimarykey = "id";
        if(isVirtualForm){
            vdatasource = Util.null2String(modeFormComInfo.getVDataSource(formID));
            vprimarykey = Util.null2String(modeFormComInfo.getVPrimaryKey(formID));	//主键列名称
        }
        int opentype = 0;
        String sliderPercentage = "";
        int customid = 0;
        String showmethod = "";
        int userid = 0;
        int enabled = -1;
        boolean isenabled = false;
        String viewfrom = "";//来源
        RecordSet recordSet = new RecordSet();
        String sqlStr = "";
        String tablename = workflowBillComInfo.getTablename(formID);
        if(isVirtualForm){
            tablename = VirtualFormHandler.getRealFromName(tablename);
        }
        String pageid = CubeUtil.getPageId(repordid);
        HashMap<String, HashMap<String, Object>> thisCache = cache.get(pageid);
        if(thisCache == null) {
            thisCache = new HashMap<String, HashMap<String, Object>>();
            cache.put(pageid, thisCache);
        }

        HashMap<String, Object> dataMap = thisCache.get("data");
        if(dataMap==null) {
            dataMap = new HashMap<String, Object>();
            thisCache.put("data", dataMap);
        }
        HashMap<String,String> curDataMap = (HashMap<String, String>) dataMap.get(modedataid);
        if(curDataMap==null) {
            curDataMap = new HashMap<String, String>();
            dataMap.put(modedataid, curDataMap);
            if (!StringHelper.isEmpty(tablename)) {
                sqlStr = "select * from "+tablename+" where "+vprimarykey+"= ? ";
                if("".equals(vdatasource)) vdatasource = null;
                RecordSet.executeSql(sqlStr, true, vdatasource, modedataid);
                String [] cols = RecordSet.getColumnName();
                if(RecordSet.next()){
                    for(String str :cols) {
                        curDataMap.put(str.toLowerCase(), RecordSet.getString(str));
                    }
                }
            }
        }
        HashMap<String, Object> detailDataMap = thisCache.get("detaildata");
        if(detailDataMap==null) {
            detailDataMap = new HashMap<String, Object>();
            thisCache.put("detaildata", detailDataMap);
        }
        HashMap<String,String> curDetailDataMap = (HashMap<String, String>) detailDataMap.get(detailid);
        //如果模块查询中含有明细表 查询出相应detaildid明细表的数据
        if (!StringHelper.isEmpty(detailtablename)&&!StringHelper.isEmpty(detailid)&&!detailid.equals(" ")) {
            if(curDetailDataMap==null) {
                detailDataMap.clear();
                curDetailDataMap = new HashMap<String, String>();
                detailDataMap.put(detailid, curDetailDataMap);
                sqlStr = "select * from "+detailtablename+" where id='"+detailid+"'";
                if("".equals(vdatasource)) vdatasource = null;
                RecordSet.executeSql(sqlStr, vdatasource);
                String [] cols = RecordSet.getColumnName();
                if(RecordSet.next()){
                    for(String str :cols) {
                        curDetailDataMap.put("dt."+str.toLowerCase(), RecordSet.getString(str));
                    }
                }
            }
        }

        if(formmodeid.equals("0")){
            formmodeid = Util.null2String(curDataMap.get("formmodeid"),"0");
        }else if(formmodeid.equals("virtual")){
            formmodeid = "0";
        }

        if(tempStr.length>14){
            opentype = Util.getIntValue(tempStr[12+pcount],0);
            customid = Util.getIntValue(tempStr[13+pcount],0);
            viewfrom = Util.null2String(tempStr[14+pcount]);
        }
        if(opentype == 2){
            if(tempStr.length==19){
                sliderPercentage = Util.null2String(tempStr[18+pcount]);
            }
        }
        if(tempStr.length>15){
            showmethod = Util.null2String(tempStr[15+pcount]);
        }

        isenabled = customSearchComInfo.getEnabled(customid+"");
        if(tempStr.length>16){
            userid = Util.getIntValue(tempStr[16+pcount]);
            enabled = Util.getIntValue(tempStr[17+pcount]);
        }

        if(isshowmethod){
            showmethod = "0";
        }
        String fieldname = "";
        fieldhtmltype = "";
        String type = "" ;
        String detailtable = "";

        if(curDetailDataMap!=null){
            curDataMap.putAll(curDetailDataMap);
        }

        String fieldsql = "select * from workflow_billfield where id="+fieldid;
        rs.executeSql(fieldsql);
        while(rs.next()){
            fieldname = rs.getString("fieldname");
            fieldhtmltype = rs.getString("fieldhtmltype");
            type = rs.getString("type");
            detailtable = rs.getString("detailtable");
        }
        if(detailtable.length()>0){
            fieldvalue = Util.null2String(curDataMap.get("dt."+fieldname.toLowerCase()));
        }else{
            fieldvalue = Util.null2String(curDataMap.get(fieldname.toLowerCase()));
        }
        String param = paraTwo;
        String retstr = Util.null2String(fieldvalue);
        if(param.endsWith("+$issumcolumn$")){
            issumcolumn = true;
            param = param.replace("+$issumcolumn$","");
        }

        //值为null，并且不是check框，直接返回
//        if("".equals(fieldvaluedes)&&(!"4".equals(fieldhtmltype)&&!("3".equals(fieldhtmltype)&&"2".equals(type)))){
//            return retstr;
//        }
        if("".equals(fieldvalue)){
            if("4".equals(fieldhtmltype)||"5".equals(fieldhtmltype)||("3".equals(fieldhtmltype)&&"2".equals(type))||("1".equals(fieldhtmltype)&&!"1".equals(type))){

            }else{
                return retstr;
            }
        }
        if("1".equals(fieldhtmltype)&&"5".equals(type)){
            fieldvalue = fieldvalue.replaceAll(",", "");
        }
        String returnvalue = "";
        //日期类型
        if("-1".equals(fieldid)){
            retstr = fieldvalue + " " + fieldvalue;
            String currentdate = TimeUtil.getCurrentDateString();//		当前日期
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String _fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue"));
                String fieldoptvalue = explainDateGet(_fieldoptvalue,param,true);
                String _fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2"));
                String fieldoptvalue2 = explainDateGet(_fieldoptvalue2,param,true);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
                String displaystyles = Util.null2String(rs.getString("displaystyles"));

                String rowbackvalue = Util.null2String(rs.getString("rowbackvalue"));
                String rowfontvalue = Util.null2String(rs.getString("rowfontvalue"));

//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }

                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);

//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }

                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                //先替换$currentdate$，后比较
                boolean flag1 = true;
                boolean flag2 = true;

                if(fieldopt==7||fieldopt==8){//7为空  8不为空
                    boolean result = changeShowmethodNullOrNotNUll(fieldopt, fieldvalue);
                    flag1 = result;
                    flag2 = result;
                }else if(fieldvalue.length()>0) {
                    if(!"".equals(_fieldoptvalue)){
                        if(!"".equals(fieldoptvalue)){
                            flag1 = false;
                            /*int num = 0;
                            if(fieldoptvalue.indexOf("$currentdate$")>-1){
                                num = Util.getIntValue(fieldoptvalue.substring(fieldoptvalue.indexOf("$currentdate$")+"$currentdate$".length()),0);
                                fieldoptvalue = DateHelper.dayMove(currentdate, num);
                            }*/
                            long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue);
                            if(1==fieldopt){
                                if(day>0){
                                    flag1 =true;
                                }
                            }
                            if(2==fieldopt){
                                if(day>=0){
                                    flag1 =true;
                                }
                            }
                            if(5==fieldopt){
                                if(day==0){
                                    flag1 =true;
                                }
                            }
                            if(6==fieldopt){
                                if(day!=0){
                                    flag1 =true;
                                }
                            }
                        }else{
                            flag1 = false;
                        }
                    }
                    if(!"".equals(_fieldoptvalue2)){
                        if(!"".equals(fieldoptvalue2)){
                            flag2 = false;
                            /*int num = 0;
                            if(fieldoptvalue2.indexOf("$currentdate$")>-1){
                                num = Util.getIntValue(fieldoptvalue2.substring(fieldoptvalue2.indexOf("$currentdate$")+"$currentdate$".length()),0);
                                fieldoptvalue2 = DateHelper.dayMove(currentdate, num);
                            }*/
                            long day = DateHelper.getDaysBetween(fieldvalue,fieldoptvalue2);
                            if(3==fieldopt2){
                                if(day<0){
                                    flag2 =true;
                                }
                            }
                            if(4==fieldopt2){
                                if(day<=0){
                                    flag2 =true;
                                }
                            }
                            if(5==fieldopt2){
                                if(day==0){
                                    flag2 =true;
                                }
                            }
                            if(6==fieldopt2){
                                if(day!=0){
                                    flag2 =true;
                                }
                            }
                        }else{
                            flag2 = false;
                        }
                    }
                    if("".equals(_fieldoptvalue)&&"".equals(_fieldoptvalue2)){
                        flag1 = false;
                        flag2 = false;
                    }
                }else{
                    flag1 = false;
                    flag2 = false;
                }
                if(flag1&flag2){
//                    retstr = Util.replaceString(fieldshowvalue, "$createdate$", fieldvalue);
//                    retstr = Util.replaceString(retstr, "$createtime$", fieldvaluedes);
//                    retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
//                    retstr="background-color:"+rowbackvalue+";color:"+rowfontvalue+";";
                    returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                    break;
                }
            }
            return returnvalue;
        }else if(!"-1".equals(fieldid)&&"3".equals(fieldhtmltype)&&"2".equals(type)){
            String currentdate = TimeUtil.getCurrentDateString();//		当前日期
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String _fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue"));
                String fieldoptvalue = explainDateGet(_fieldoptvalue,param,false);
                String _fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2"));
                String fieldoptvalue2 = explainDateGet(_fieldoptvalue2,param,false);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));

                String rowbackvalue = Util.null2String(rs.getString("rowbackvalue"));
                String rowfontvalue = Util.null2String(rs.getString("rowfontvalue"));

//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }
//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }
                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);
                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                //先替换$currentdate$，后比较
                boolean flag1 = true;
                boolean flag2 = true;

                if(fieldopt==7||fieldopt==8){//7为空  8不为空
                    boolean result = changeShowmethodNullOrNotNUll(fieldopt, fieldvalue);
                    flag1 = result;
                    flag2 = result;
                }else if(fieldvalue.length()>0) {

                    if (!"".equals(_fieldoptvalue)) {
                        if (!"".equals(fieldoptvalue)) {
                            flag1 = false;
		    			/*int num = 0;
		    			if(fieldoptvalue.indexOf("$currentdate$")>-1){
		    				num = Util.getIntValue(fieldoptvalue.substring(fieldoptvalue.indexOf("$currentdate$")+"$currentdate$".length()),0);
		    				fieldoptvalue = DateHelper.dayMove(currentdate, num);
		    			}*/
                            long day = DateHelper.getDaysBetween(fieldvalue, fieldoptvalue);
                            if (1 == fieldopt) {
                                if (day > 0) {
                                    flag1 = true;
                                }
                            }
                            if (2 == fieldopt) {
                                if (day >= 0) {
                                    flag1 = true;
                                }
                            }
                            if (5 == fieldopt) {
                                if (day == 0) {
                                    flag1 = true;
                                }
                            }
                            if (6 == fieldopt) {
                                if (day != 0) {
                                    flag1 = true;
                                }
                            }
                        } else {
                            flag1 = false;
                        }
                    }
                    if (!"".equals(_fieldoptvalue2)) {
                        if (!"".equals(fieldoptvalue2)) {
                            flag2 = false;
		    			/*int num = 0;
		    			if(fieldoptvalue2.indexOf("$currentdate$")>-1){
		    				num = Util.getIntValue(fieldoptvalue2.substring(fieldoptvalue2.indexOf("$currentdate$")+"$currentdate$".length()),0);
		    				fieldoptvalue2 = DateHelper.dayMove(currentdate, num);
		    			}*/
                            long day = DateHelper.getDaysBetween(fieldvalue, fieldoptvalue2);
                            if (3 == fieldopt2) {
                                if (day < 0) {
                                    flag2 = true;
                                }
                            }
                            if (4 == fieldopt2) {
                                if (day <= 0) {
                                    flag2 = true;
                                }
                            }
                            if (5 == fieldopt2) {
                                if (day == 0) {
                                    flag2 = true;
                                }
                            }
                            if (6 == fieldopt2) {
                                if (day != 0) {
                                    flag2 = true;
                                }
                            }
                        } else {
                            flag2 = false;
                        }
                    }

                    if("".equals(_fieldoptvalue)&&"".equals(_fieldoptvalue2)){
                        flag1 = false;
                        flag2 = false;
                    }
                }else{
                    flag1 = false;
                    flag2 = false;
                }

                if(flag1&flag2){
                    //retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                    retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                    retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+retstr+"</span>";
                    returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                    break;
                }
            }
            return returnvalue;
        }else if(!"-1".equals(fieldid)&&"1".equals(fieldhtmltype)&&!"1".equals(type)){
            retstr = fieldvalue;
            float value =  Util.getFloatValue(fieldvalue);
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt2"),-1);
                String fieldoptvalue = Util.null2String(rs.getString("fieldoptvalue")).trim();
                String fieldoptvalue2 = Util.null2String(rs.getString("fieldoptvalue2")).trim();
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));
                int displaystyles = Util.getIntValue(rs.getString("displaystyles"),0);

                String rowbackvalue = Util.null2String(rs.getString("rowbackvalue"));
                String rowfontvalue = Util.null2String(rs.getString("rowfontvalue"));
//                if(fieldoptvalue.indexOf("$")>-1){
//                    fieldoptvalue = fieldoptvalue.replaceAll("\\$", "").toLowerCase();
//                    fieldoptvalue = curDataMap.get(fieldoptvalue);
//                }
//                if(fieldoptvalue2.indexOf("$")>-1){
//                    fieldoptvalue2 = fieldoptvalue2.replaceAll("\\$", "").toLowerCase();
//                    fieldoptvalue2 = curDataMap.get(fieldoptvalue2);
//                }
                fieldoptvalue = this.convertFieldValue(fieldoptvalue,curDataMap);
                fieldoptvalue2 = this.convertFieldValue(fieldoptvalue2,curDataMap);

                boolean flag1 = true;
                boolean flag2 = true;

                if(fieldopt==7||fieldopt==8){//7为空  8不为空
                    boolean result = changeShowmethodNullOrNotNUll(fieldopt, fieldvalue);
                    flag1 = result;
                    flag2 = result;
                }else if(fieldvalue.length()>0){
                    if (!"".equals(fieldoptvalue)) {
                        flag1 = false;
                        if (1 == fieldopt) {
                            if (value > Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (2 == fieldopt) {
                            if (value >= Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (5 == fieldopt) {
                            if (value == Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                        if (6 == fieldopt) {
                            if (value != Util.getFloatValue(fieldoptvalue)) {
                                flag1 = true;
                            }
                        }
                    }
                    if (!"".equals(fieldoptvalue2)) {
                        flag2 = false;

                        if (3 == fieldopt2) {
                            if (value < Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (4 == fieldopt2) {
                            if (value <= Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (5 == fieldopt2) {
                            if (value == Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                        if (6 == fieldopt2) {
                            if (value != Util.getFloatValue(fieldoptvalue2)) {
                                flag2 = true;
                            }
                        }
                    }
                }else{
                    flag1 = false;
                    flag2 = false;
                }

                if(flag1&flag2){
//                    retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                    retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                    if(type.equals("2") || type.equals("3")){
//                        if(fieldshowvalue.indexOf("Amount") > -1){ //金额大写
//                            fieldvaluedes = NumToChinese(fieldvaluedes);
//                            retstr = Util.replaceString(fieldshowvalue, "Amount($"+fieldname+"$)", fieldvaluedes);
//                        }
//                        if(fieldshowvalue.indexOf("Thousands") > -1){  // 金额千分位转换
//                            fieldvaluedes = changeToThousands(fieldvaluedes);
//                            retstr = Util.replaceString(fieldshowvalue, "Thousands($"+fieldname+"$)", fieldvaluedes);
//                        }
//                    }
//                    if(issumcolumn){
//                        return retstr;
//                    }
                    //                    样式1：
//                    <div class="csProgressBar"><div style="width:$obj2$%;"><span>$obj2$%</span></div></div>
//                    样式2：
//                    <div class="csProgressBar csProgressBarGold"><div style="width:$jd$%;"><span>$jd$%</span></div></div>
//                    样式3：
//                    <div class="csProgressBar csProgressBarRed"><div style="width:$jd$%;"><span>$jd$%</span></div></div>

//                    if(displaystyles==1){
//                        retstr = "<div class=\"csProgressBar\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
//                    }else if(displaystyles==2){
//                        retstr = "<div class=\"csProgressBar csProgressBarGold\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
//                    }else if(displaystyles==3){
//                        retstr = "<div class=\"csProgressBar csProgressBarRed\"><div style=\"width:"+retstr+"%;\"><span>"+retstr+"%</span></div></div>";
//                    }
                    //retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
//                    retstr="background-color:"+rowbackvalue+";color:"+rowfontvalue+";";
                    returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                    break;
                }
            }
            return returnvalue;
        }else{
            retstr = fieldvalue;
            float value =  Util.getFloatValue(fieldvalue);
            rs.executeSql("select * from customfieldshowchange where customid="+customid+" and fieldid="+fieldid);
            while(rs.next()){
                //数字   <!--大于,大于或等于,小于,小于或等于,等于,不等于-->
                int fieldopt =  Util.getIntValue(rs.getString("fieldopt"),-1);
                //int fieldopt2 =  Util.getIntValue(rs.getString("fieldopt"),-1);
                float fieldoptvalue = Util.getFloatValue(rs.getString("fieldoptvalue"),0);
                //float fieldoptvalue2 = Util.getFloatValue(rs.getString("fieldoptvalue2"),0);
                String fieldshowvalue = Util.null2String(rs.getString("fieldshowvalue"));
                String fieldbackvalue = Util.null2String(rs.getString("fieldbackvalue"));
                String fieldfontvalue = Util.null2String(rs.getString("fieldfontvalue"));

                String rowbackvalue = Util.null2String(rs.getString("rowbackvalue"));
                String rowfontvalue = Util.null2String(rs.getString("rowfontvalue"));
                if(fieldopt==1)	{
                    if(value>fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                if(fieldopt==2)	{
                    if(value>=fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                if(fieldopt==3)	{
                    if(value<fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                if(fieldopt==4)	{
                    if(value<=fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                if(fieldopt==5)	{
                    //选择框
                    if("4".equals(fieldhtmltype)){
                        if("".equals(fieldvalue)){
                            value = 0;
                        }
                    }
                    if(value==fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                if(fieldopt==6)	{
                    if(value!=fieldoptvalue){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }

                //下拉框为空
                if(fieldopt==7)	{
                    if(value==-1){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
                //下拉框不为空
                if(fieldopt==8)	{
                    if(value!=-1){
//                        retstr = Util.replaceString(fieldshowvalue, "$"+fieldname+"$", fieldvaluedes);
//                        retstr = this.convertFieldValue(fieldshowvalue,curDataMap);
//                        retstr ="<span style='background-color:"+fieldbackvalue+";"+"+color:"+fieldfontvalue+";'>"+convertNull2HTML(retstr)+"</span>";
                        returnvalue="{\"backgroundColor\":\""+rowbackvalue+"\",\"color\":\""+rowfontvalue+"\"}";
                        break;
                    }
                }
            }
            return returnvalue;
        }
    }




    public static void clearCache(String pageUId) {
        cache.remove(pageUId);
    }

    /**
     * //显示转换为空或者不为空的判断
     * @param fieldopt   //配置选择的值 7或8
     * @param fieldvalue //表单上的值
     * @return
     */
    private boolean changeShowmethodNullOrNotNUll(int fieldopt ,String fieldvalue){
        boolean result = true;
        if(fieldopt==7){//7为空
            if(fieldvalue.length()==0){
                result = true;
            }else{
                result = false;
            }
        }else if(fieldopt==8){//8不为空
            if(fieldvalue.length()>0){
                result = true;
            }else{
                result = false;
            }
        }
        return result;
    }

    public String convertNull2HTML(String str){
        if(str.length()==0){
            return "&nbsp;";
        }
        return str;
    }

//    private String changeFieldValue(String fieldoptvalue,HashMap<String,String> curDataMap){
//        fieldoptvalue = fieldoptvalue.toLowerCase();
//        fieldoptvalue = fieldoptvalue.replaceAll("$", "").toLowerCase();
//        fieldoptvalue = curDataMap.get(fieldoptvalue);
//        return fieldoptvalue;
//    }
    private String convertFieldValue(String fieldoptvalue,Map<String,String> curDataMap){
        return this.convertFieldValue(fieldoptvalue,curDataMap,false);
    }

    private String convertFieldValue(String fieldoptvalue,Map<String,String> curDataMap,boolean isReturn){
        if(fieldoptvalue.indexOf("$")==-1){
            return fieldoptvalue;
        }
        List<String>  list = new ArrayList<>();
        String rgex = "\\$[a-zA-Z0-9._]*\\$";
        //1.将正在表达式封装成对象Patten 类来实现
        Pattern pattern = Pattern.compile(rgex);
        //2.将字符串和正则表达式相关联
        Matcher matcher = pattern.matcher(fieldoptvalue);
        //查找符合规则的子串
        while(matcher.find()){
            String key = Util.null2String(matcher.group().toString());
            if(key.length()>0){
                key = key.replaceAll("\\$","");
                key = key.toLowerCase();

                if(isReturn) {
                    fieldoptvalue = fieldoptvalue.replace(matcher.group().toString(), Util.null2String(curDataMap.get("returnstr_"+key)));
                }else{
                    fieldoptvalue = fieldoptvalue.replace(matcher.group().toString(),Util.null2String(curDataMap.get(key)));
                }
            }
        }
        return fieldoptvalue;
    }

    /**
     * 正则表达式匹配两个指定字符串中间的内容
     * @param soap
     * @return
     */
    public static String getSubUtil(String soap,String replaceText){
        List<String>  list = new ArrayList<>();
        String rgex = "\\$[a-zA-Z0-9_]*\\$";
        //1.将正在表达式封装成对象Patten 类来实现
        Pattern pattern = Pattern.compile(rgex);
        //2.将字符串和正则表达式相关联
        Matcher matcher = pattern.matcher(soap);
        int i=0;
        //查找符合规则的子串
        while(matcher.find()){

            //获取 字符串
//            System.out.println(matcher.group());
//            //获取的字符串的首位置和末位置
//            System.out.println(matcher.start()+"--"+matcher.end());
//            System.out.println(matcher.toMatchResult()+"<>"+matcher.toString());
            soap = soap.replace(matcher.group().toString(),replaceText);
        }
        return soap;
    }

    public static void main(String[] args){
        String content = "asd$content$fff$aabc$";
        //System.out.println(content.replaceAll("\\$content\\$",""));
    }

    /**
     * GetDate函数转换为字符串
     * @param conditionSql
     * @return
     */
    public String getConvertGetDate(String conditionSql,String param,boolean iscreatedate){
        String startStr = "GetDate(";
        int startIndex = conditionSql.indexOf(startStr);
        if(startIndex>-1){
             int endIndex = conditionSql.indexOf(")",startIndex);
            if(endIndex>-1&&endIndex>startIndex){
                String str1 = conditionSql.substring(startIndex,endIndex+1);
                String newDate = this.explainDateGet(str1,param,iscreatedate);
                conditionSql = conditionSql.replace(str1,newDate);
                conditionSql = this.getConvertGetDate(conditionSql,param,iscreatedate);
            }
            //System.out.println("explainDateGet======================="+result);
        }
        conditionSql = conditionSql.replace("$date$", DateHelper.getCurrentDate());

        return conditionSql;
    }
    
    
    public static Map<String, Object> getBrowserParms(Browser browser,RecordSet rs,String detailtablename,String languageId){
    	List<String> conditionFieldMap = browser.getConditionFieldMap();
    	Map<String, String> cusDependFieldValues = new HashMap<String, String>(); 
		if (conditionFieldMap.size()>0) {
			for (String condition : conditionFieldMap) {
				String filename=condition;
				if (!"".equals(detailtablename)&&condition.startsWith(detailtablename)) {//如果是明细表字段
					filename="d_"+condition.replace(detailtablename+"_", "");;
				}
				if (rs!=null) {
					cusDependFieldValues.put(condition, rs.getString(filename));
				}
			}
		}
		Map<String, Object> parms = CardFormHelper.getParms(cusDependFieldValues, languageId);
		return parms;
    }
    
    /**
     * 获取浏览框回显参数
     * @param browser
     * @param curDataMap 主表数据
     * @param curDetailDataMap 明细表数据
     * @param detailtablename 明细表表名
     * @param languageId 
     * @return
     */
    public static Map<String, Object> getBrowserParms(Browser browser,HashMap<String,String> curDataMap,
    		HashMap<String,String> curDetailDataMap,String detailtablename,String languageId){
    	return getBrowserParms(browser, null, detailtablename, languageId);
    }

    /**
     * @Method : getDatime
     * @Description : 提取字符串中包含的日期格式
     * @param  strs 传入的字符串
     * @return : List<String> 返回日期的List
     * @author : xk
     * @CreateDate : 2019-09-17 17:00:44
     */
    public static List<String> getDatime(String strs) {
        List<String> dateStrList = new ArrayList<>();
        String dateStr = "";
        if (StringUtils.isNotEmpty(strs)) {
            Pattern p = Pattern.compile("(\\d{4})-(\\d{1,2})-(\\d{1,2})");
            Matcher m = p.matcher(strs);
            while (m.find()) {
                dateStr += m.group() + "end";
            }
        }
        if (StringUtils.isNotEmpty(dateStr)) {
            String str[] = dateStr.split("end");
            if (str.length > 1) {
                if (StringUtils.isNotEmpty(str[0])) {
                    dateStrList.add(str[0]);
                }
                if (StringUtils.isNotEmpty(str[1])) {
                    dateStrList.add(str[1]);
                }
            }
        }
        return dateStrList;
    }

    /**
     * @Method : DaysFuc
     * @Description : 计算日期差函数
     * @param fieldshowvalue : DAYS(2019-12-12,2019-12-13)
     * @return : java.lang.String
     * @author : xk
     * @CreateDate : 2019-09-17 17:00:44
     */
    public static String DaysFuc(String fieldshowvalue) {
        String result = "";
        String tempStr = "";
        List<String> stringList = new ArrayList<>();
        Pattern p = Pattern.compile("DAYS\\(.*?\\)");
        Matcher m = p.matcher(fieldshowvalue);
        boolean flag = false;
        while (m.find()) {
            String daysStr = m.group();
            List<String> dates = getDatime(daysStr);
            int begin = fieldshowvalue.indexOf("DAYS(");
            int end = fieldshowvalue.indexOf(")", begin + 1);
            if (dates.size() > 1) {
                flag = true;
                String interval = Util.null2String(TimeUtil.dateInterval(dates.get(0), dates.get(1)));
                tempStr = fieldshowvalue.substring(0, begin) + interval;
                fieldshowvalue = fieldshowvalue.substring(end + 1, fieldshowvalue.length());
                stringList.add(tempStr);
            }
        }
        if (flag) {//有匹配的就输出
            stringList.add(fieldshowvalue);
            tempStr = stringList.stream().collect(Collectors.joining(""));
            return tempStr;
        }
        return result;
    }

    /**
     * @Method : getSpecialValue
     * @Description :显示转换，支持t1.col[text]方法
     * @param key : xxx$colName[text]$xxx
     * @param fieldvalue : 
     * @param workformid : workflow_billfield表的billid
     * @param user : 
     * @param rs : 
     * @return : java.lang.String
     * @author : xk
     * @CreateDate : 2019-11-22 17:08:07
     */
    public String getSpecialValue(String key, String fieldvalue, String workformid, User user, RecordSet rs) {
        String value = fieldvalue;
        if (key.contains("[text]")) {
            key = key.replaceAll(FieldUtil.quoteReplacement("[text]"), "");
            int index = key.indexOf(".");
            String viewtype = index != -1 ? key.substring(0, index) : " ";
            if ("d1".equals(viewtype)) {//解决重名问题
                viewtype = " and viewtype = 1 ";
            }else {
                viewtype = " ";
            }
            String specialFiedname = index != -1 ? key.substring(index+1, key.length()) : key;
            rs.executeQuery("select fieldhtmltype,type,fielddbtype,id from workflow_billfield where billid = ? and upper(fieldname) = upper(?) " + viewtype, workformid, specialFiedname);
            if (rs.next()) {
                String fieldhtmltype = rs.getString("fieldhtmltype");
                String fieldtype = rs.getString("type");
                String fielddbtype = rs.getString("fielddbtype");
                String fieldid = rs.getString("id");
                value = getSpeicalShowNames(fieldhtmltype, fieldtype, fielddbtype, fieldvalue, fieldid, user.getLanguage(), rs);
            }
        }
        return value;
    }

    /**
     * @Method : getSpeicalShowNames
     * @Description : 获取浏览按钮的显示值（不带链接，没有关联授权）和下拉框的值
     * @param fieldhtmltype : 
     * @param fieldtype : 
     * @param dbtype : 
     * @param fieldvalue : 
     * @param fieldid : 
     * @param userlanguage : 
     * @param rs : 
     * @return : java.lang.String
     * @author : xk
     * @CreateDate : 2019-11-22 17:09:34
     */
    public String getSpeicalShowNames(String fieldhtmltype, String fieldtype, String dbtype, String fieldvalue, String fieldid, int userlanguage, RecordSet rs) {
        String returnStr = fieldvalue;
        String sql = "";
        if (fieldhtmltype.equals("3")) {
            if (fieldtype.equals("2") || fieldtype.equals("19")) {    // 日期和时间
                returnStr = fieldvalue;
            } else if (fieldtype.equals("290")) {//时间日期字段
                returnStr = fieldvalue;
                if (returnStr != null && returnStr.indexOf(":") != returnStr.lastIndexOf(":")) {
                    returnStr = returnStr.substring(0, returnStr.lastIndexOf(":"));
                }
            } else if (fieldtype.equals("224") || fieldtype.equals("225") || fieldtype.equals("226") || fieldtype.equals("227")) {
                returnStr = fieldvalue;
            } else if (!fieldvalue.equals("")) {
//                String linkurl = getBrowserLinkurl(fieldtype);
                String linkurl = "";//xk:不要链接样式便于拓展
                ;    // 浏览值点击的时候链接的url
                String showname = "";                                                   // 值显示的名称
//                String showid = "";                                                     // 值

                ArrayList tempshowidlist = Util.TokenizerString(fieldvalue, ",");
                if (fieldtype.equals("8") || fieldtype.equals("135")) {
                    //项目，多项目
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (!linkurl.equals("")) {
                            showname += "<a href=\"" + linkurl + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                    ProjectInfoComInfo1.getProjectInfoname((String) tempshowidlist.get(k)) + "</a>&nbsp;";
                        } else {
                            showname += ProjectInfoComInfo1.getProjectInfoname((String) tempshowidlist.get(k)) + " ";
                        }
                    }
                } else if (fieldtype.equals("1") || fieldtype.equals("17") || fieldtype.equals("165") || fieldtype.equals("166")) {
                    //人员，多人员
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (!linkurl.equals("")) {
                            showname += "<a href=javaScript:openhrm(" + tempshowidlist.get(k) + ") onclick=pointerXY(event)>" +
                                    rc.getResourcename((String) tempshowidlist.get(k)) + "</a>&nbsp;";
                        } else {
                            showname += rc.getResourcename((String) tempshowidlist.get(k)) + " ";
                        }
                    }
                } else if (fieldtype.equals("7") || fieldtype.equals("18")) {
                    //客户，多客户
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (!linkurl.equals("")) {
                            showname += "<a href=\"" + linkurl + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                    cci.getCustomerInfoname((String) tempshowidlist.get(k)) + "</a>&nbsp;";
                        } else {
                            showname += cci.getCustomerInfoname((String) tempshowidlist.get(k)) + " ";
                        }
                    }
                } else if (fieldtype.equals("4") || fieldtype.equals("57") || fieldtype.equals("167") || fieldtype.equals("168")) {
                    //部门，多部门，单权部门，单权多部
                    orgShowBiz = new OrganizationShowSetBiz();
                    String sepCharacter = orgShowBiz.getSepCharacter();
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        String departmentShow = orgShowBiz.getDepartmentShow("model", (String)tempshowidlist.get(k));
                        if(sepCharacter.equals(departmentShow)){
                            departmentShow = "";
                        }
                        if (!linkurl.equals("")) {
                            showname += "<a href=\"" + linkurl + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                    departmentShow + "</a>&nbsp;";
                        } else {
                            if(!departmentShow.equals("")) {
                                showname += departmentShow + " ";
                            }
                        }
                    }
                } else if (fieldtype.equals("9") || fieldtype.equals("37")) {
                    //文档，多文档
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (k > 0) showname += "<br>";
                        {
                            if (!linkurl.equals("")) {
                                showname += "<a href=\"" + linkurl + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                        DocComInfo1.getDocname((String) tempshowidlist.get(k)) + "</a>";
                            } else {
                                showname += DocComInfo1.getDocname((String) tempshowidlist.get(k));
                            }
                        }
                    }
                } else if (fieldtype.equals("22")) {
                    //报销费用类型
                    FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo();
                    String separator = Util.null2String(fnaSystemSetComInfo.get_separator()).trim();
                    int enableDispalyAll = Util.getIntValue(fnaSystemSetComInfo.get_enableDispalyAll());
                    String fullName = "";
                    if (enableDispalyAll == 1) {
                        BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo();
                        String[] valueArr = fieldvalue.split(",");
                        for (String keyid : valueArr) {
                            fullName = budgetfeeTypeComInfo.getSubjectFullName(keyid, separator);
                            if (!linkurl.equals("")) {
                                showname += "<a href=\'" + linkurl + tempshowidlist.get(Integer.parseInt(keyid)) + "\' target=\'_new\'>" + fullName + "</a>&nbsp;";
                            } else {
                                showname += fullName + " ";
                            }
                        }
                    } else {
                        BrowserComInfo bci = new BrowserComInfo();
                        String tablenamefylx = bci.getBrowsertablename(fieldtype + ""); // 浏览框对应的表,比如人力资源表
                        String columname = bci.getBrowsercolumname(fieldtype + ""); // 浏览框对应的表名称字段
                        String keycolumname = bci.getBrowserkeycolumname(fieldtype + ""); // 浏览框对应的表值字段
                        String bxsql = "select " + keycolumname + "," + columname + " from " + tablenamefylx + " where " + keycolumname + " in ( " + fieldvalue + ")";
                        rs.executeSql(bxsql);
                        while (rs.next()) {
                            String tempshowname = Util.null2String(rs.getString(2));
                            if (!linkurl.equals("")) {
                                showname += "<a href=\'" + linkurl + tempshowidlist.get(Util.getIntValue(rs.getString(1))) + "\' target=\'_new\'>" +
                                        tempshowname + "</a>&nbsp;";
                            } else {
                                showname += tempshowname + " ";
                            }
                        }
                    }
                } else if (fieldtype.equals("23")) {
                    //资产
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (!linkurl.equals("")) {
                            showname += "<a href=\'" + linkurl + tempshowidlist.get(k) + "\' target=\'_new\'>" +
                                    CapitalComInfo1.getCapitalname((String) tempshowidlist.get(k)) + "</a>&nbsp;";
                        } else {
                            showname += CapitalComInfo1.getCapitalname((String) tempshowidlist.get(k)) + " ";
                        }
                    }
                } else if (fieldtype.equals("16") || fieldtype.equals("152") || fieldtype.equals("171")) {
                    //相关请求
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (k > 0) showname += "<br>";
                        if (!linkurl.equals("")) {
                            int tempnum = 0;
                            tempnum++;
                            showname += "<a href=\"" + linkurl.replace("isrequest=1&", "") + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                    WorkflowRequestComInfo1.getRequestName((String) tempshowidlist.get(k)) + "</a>";
                        } else {
                            showname += WorkflowRequestComInfo1.getRequestName((String) tempshowidlist.get(k))+" ";
                        }
                    }
                } else if (fieldtype.equals("141")) {
                    //人力资源条件
                    if ("".equals(linkurl)) {
                        showname += rcm.getFormShowNameOfNoLink(fieldvalue, userlanguage);
                    }else {
                        showname += rcm.getFormShowName(fieldvalue, userlanguage);
                    }

                }
                //added by alan for td:10814
                else if (fieldtype.equals("142")) {
                    //收发文单位
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        if (!linkurl.equals("")) {
                            showname += "<a href='" + linkurl + tempshowidlist.get(k) + "' target='_new'>" +
                                    duc.getReceiveUnitName("" + tempshowidlist.get(k)) + "</a>&nbsp;";
                        } else {
                            showname += duc.getReceiveUnitName("" + tempshowidlist.get(k)) + " ";
                        }
                    }
                } else if (fieldtype.equals("161") || fieldtype.equals("162")) {// -fsp 自定义浏览框
                    if (Util.null2String(dbtype).length() == 0) return "";
                    try {
                        Browser browser = (Browser) StaticObj.getServiceByFullname(dbtype, Browser.class);
                        for (int k = 0; k < tempshowidlist.size(); k++) {
                            BrowserBean bb = browser.searchById((String) tempshowidlist.get(k));
                            String name = Util.null2String(bb.getName());
                            if (showname.equals("")) {
                                showname += name;
                            } else {
                                showname += "," + name;
                            }
                        }
                    } catch (Exception e) {
                        new BaseBean().writeLog(e);
                    }
                } else if (fieldtype.equals("256") || fieldtype.equals("257")) {//自定义树形单选
                    CustomTreeUtil customTreeUtil = new CustomTreeUtil();
//                    showid = fieldvalue;
//                    if (this.isTemplate != null && !this.isTemplate.equals("") && this.isTemplate.equals("true")) {
//                        showname = customTreeUtil.getTreeFieldShowName(fieldvalue, dbtype, "onlyname");
//                    } else {
//                        showname = customTreeUtil.getTreeFieldShowName(fieldvalue, dbtype, "openByTreeField");
//                    }
                    showname = customTreeUtil.getTreeFieldShowName(fieldvalue, dbtype, "onlyname");
                    showname = CubeCipherUitl.decryptByRegEx(showname);
                } else if (fieldtype.equals("164") || fieldtype.equals("194") || fieldtype.equals("170") || fieldtype.equals("169")) {      //分部
                    orgShowBiz = new OrganizationShowSetBiz();
                    String sepCharacter = orgShowBiz.getSepCharacter();
                    //分部，多分部，单权分部，单权多分部
                    for (int k = 0; k < tempshowidlist.size(); k++) {
                        String subcompanyShow = orgShowBiz.getSubcompanyShow("model", (String)tempshowidlist.get(k));
                        if(sepCharacter.equals(subcompanyShow)){
                            subcompanyShow = "";
                        }
                        if (!linkurl.equals("")) {
                            showname += "<a href=\"" + linkurl + tempshowidlist.get(k) + "\" target=\"_new\">" +
                                    subcompanyShow + "</a>&nbsp;";
                        } else {
                            if(!subcompanyShow.equals("")) {
                                showname += subcompanyShow + " ";
                            }
                        }
                    }
                } else {
                    String tablename1 = BrowserComInfo.getBrowsertablename(fieldtype); //浏览框对应的表,比如人力资源表
                    String columname = BrowserComInfo.getBrowsercolumname(fieldtype); //浏览框对应的表名称字段
                    String keycolumname = BrowserComInfo.getBrowserkeycolumname(fieldtype);   //浏览框对应的表值字段
                    fieldvalue = deleteFirstAndEndchar(fieldvalue, ",");
                    if (fieldvalue.indexOf(",") != -1) {
                        sql = "select " + keycolumname + "," + columname + " from " + tablename1 + " where " + keycolumname + " in( " + fieldvalue + ")";
                    } else {
                        sql = "select " + keycolumname + "," + columname + " from " + tablename1 + " where " + keycolumname + "=" + fieldvalue;
                    }
                    rs.executeSql(sql);
                    while (rs.next()) {
                        if (!linkurl.equals("")) {
                            showname += "<a href=\"javascript:cubeOpenHref('" + linkurl + rs.getString(1) + "')\" >" +
                                    Util.toScreen(rs.getString(2), userlanguage) + "</a>&nbsp;";
                        } else {
                            showname += Util.toScreen(rs.getString(2), userlanguage) + " ";
                        }
                    }    // end of while
                }
                returnStr = showname;
            }
        }
        if (fieldhtmltype.equals("5")) {
            returnStr = "";
//            rs.executeQuery("select selectvalue,selectname from workflow_selectitem " +
//                    "where fieldid = ? and selectvalue = ? and (cancel  = '0' or cancel is null)  order by listorder,id", fieldid, fieldvalue);
//            if (rs.next()) {
//                returnStr = Util.toScreen(rs.getString("selectname"), userlanguage);
//            }
            char flag = Util.getSeparator();
            rs.executeProc("workflow_SelectItemSelectByid",""+fieldid+flag+1);
            while(rs.next()){
                String tmpselectvalue = Util.null2String(rs.getString("selectvalue"));
                String tmpselectname = Util.toScreen(rs.getString("selectname"), userlanguage);
                if((","+fieldvalue+",").contains(","+tmpselectvalue+",")){
                    returnStr+=tmpselectname+",";
                }
            }
            if (returnStr.length() > 0) {
                returnStr = returnStr.substring(0, returnStr.length()-1);
            }
        }
        return returnStr;
    }
    
    
    /**
     * 权限判断
     * @param formid
     * @param user
     * @param modeidInt
     * @param opttype 权限类型  edit编辑 del删除
     * @return
     */
    private boolean haveRight(String formid,User user,int modeidInt,String sourceid,String opttype){
    	boolean isVirtualForm = VirtualFormHandler.isVirtualForm(formid);
        if(!isVirtualForm){
           	Map<String, Object> preCheck = this.getOptRightMap(user, modeidInt);
           	boolean isEdit=(boolean) preCheck.get("isedit");
           	boolean isDel=(boolean) preCheck.get("isdel");
           	if ("edit".equals(opttype)&&isEdit) {
				return true;
			}
           	if ("del".equals(opttype)&&isDel) {
				return true;
			}
           	RecordSet rs = new RecordSet();
            ModeShareManager ModeShareManager = new ModeShareManager();
            ModeShareManager.setModeId(modeidInt);
            String rightStr = ModeShareManager.getShareDetailTableByUser("formmode",user);
            rs.executeSql("select sourceid,max(sharelevel) as sharelevel from "+rightStr+" t where sourceid='"+sourceid+"' group by sourceid");
            if(rs.next()){
                int MaxShare = rs.getInt("sharelevel");
                if(MaxShare > 1) {
                	if ("edit".equals(opttype)) {
        				return true;
        			}
                    if("del".equals(opttype)&&MaxShare == 3){
                    	return true;
                    }
                }
            }
         }
        return false;
    }
    
    
    /**
     * 从缓存中获取权限信息
     * @param user 当前用户
     * @param modeid 模块id
     * @return
     */
    private Map<String, Object > getOptRightMap(User user,int modeid){
    	Map<String, Object> map = new HashMap<String, Object>();
    	String key = user.getUID()+"_"+modeid;
		clearOutTimeKey(key);
		clearCurrTimeKey(key);
		if(optRightMap.containsKey(key)){
			map= optRightMap.get(key);
		}else {//添加
			map = new ModeRightInfo().preCheckUserRight(user, modeid);
			map.put("time", System.currentTimeMillis());
			optRightMap.put(key, map);
		}
    	return map;
    }
    
    /**
     * 判断当前key是否超时,超时则删除
     * @param key
     */
    private void clearCurrTimeKey(String key) {
    	long currentTime = System.currentTimeMillis();
    	Map<String, Object> map = optRightMap.get(key);
    	if (map!=null) {
    		long time=0;
    		try {
    			time=Long.parseLong(Util.null2String(map.get("time")));
    		} catch (NumberFormatException e) {
    			new BaseBean().writeLog(e);
    		}
    		double t = (currentTime - time) / (1000.0);//当前时间-上次的时间的秒数
    		if(t>intervaltime){//120秒未活动,则移出
    			optRightMap.remove(key);
    		}
		}
	}

	/**
     * 清理缓存中过期的key
     * @param currkey
     */
    private void clearOutTimeKey(String currkey){
    	long currentTime = System.currentTimeMillis();
    	Map<String, Object> lastmap = optRightMap.get("lastClearTime");
    	if (lastmap!=null&&lastmap.containsKey("lastClearTime")) {
    		Object obj = lastmap.get("lastClearTime");
    		long time=0;
			try {
				time=Long.parseLong(Util.null2String(obj));
			} catch (NumberFormatException e) {
				new BaseBean().writeLog(e);
			}
			double t = (currentTime - time) / (1000.0);//当前时间-上次的时间的秒数
			if (t<intervaltime) {//距离上一次全部清理时间不到intervaltime,则不进行全部清理,避免频繁的循环optRightMap进行时间判断
				return;
			}
		}
    	//对所有未活动用户进行清理
		Set<String> keyset = optRightMap.keySet();
		Iterator<String> it = keyset.iterator();
		while(it.hasNext()){
			String key = it.next();
			Map<String, Object> map = optRightMap.get(key);
			long time=0;
			try {
				time=Long.parseLong(Util.null2String(map.get("time")));
			} catch (NumberFormatException e) {
				new BaseBean().writeLog(e);
			}
			double t = (currentTime - time) / (1000.0);//当前时间-上次的时间的秒数
			if(t>intervaltime){//120秒未活动,则移出
				optRightMap.remove(key);
			}
		}
		//更新最后一次全部清理时间戳
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("lastClearTime", currentTime);
		optRightMap.put("lastClearTime", map);
    }
    
    public void clearCacheByModeid(String modeid){
    	//权限改变时清理缓存
		Set<String> keyset = optRightMap.keySet();
		Iterator<String> it = keyset.iterator();
		while(it.hasNext()){
			String key = it.next();
			String[] split = key.split("_");
			if (split.length==2&&split[1].equals(modeid)) {
				optRightMap.remove(key);
			}
		}
    }

    public String getHreflink(String hreflink, String regexp,String value) {
        hreflink = hreflink.replaceAll("\\$(?i)"+regexp+"\\$",value);
        return hreflink;
    }

    public String getColumnName(RecordSet rs_page) {
        String column = "";
        if (null != rs_page) {
            String[] columns = rs_page.getColumnName();
            if (null != columns && columns.length > 0) {
                for (String columnStr : columns) {
                    if (columnStr.indexOf("mode_top_") != -1 || columnStr.indexOf("MODE_TOP_") != -1 ) {
                        column = columnStr.toLowerCase();
                    }

                }

            }

        }
        return column;
    }

    /**
     * 获取密级显示
     * @param fieldvalue
     * @param paraTwo(用加号分割的 第一个参数是用户当前语言，第二参数是保密时间modesecrettime的具体文本)
     * @return
     */
    public String getSeclevelLable(String fieldvalue, String paraTwo) {
        String seclevelLable = "";
        //参数无需判空，为固定参数 必须传入
        int language = 7;
        String secrettimeSpan ="";
        if (paraTwo.contains("+")) {
            String[] params = Util.TokenizerString2(paraTwo, "+");
            language = Util.getIntValue(params[0], 7);
            if(params.length>1){
                secrettimeSpan = (params[1] + "").trim();
            }
        }

        AddSeclevelUtil  addSeclevelUtil  = new AddSeclevelUtil();

        // 判断 展示方式
        Map<String,Object> temp = addSeclevelUtil.getSecleveDefValueStyle(new HashMap<>() );
        if(!"0".equals(temp.get(fieldvalue)+"")){// 0 展示密级和密集保护时间  1  仅展示密级字段
            secrettimeSpan="";
        }


        if (!"".equals(fieldvalue)) {
            String typespan = "";
            HrmClassifiedProtectionBiz hrmClassifiedProtectionBiz = new HrmClassifiedProtectionBiz();
            //int language = Util.getIntValue(paraTwo, 7);
            //密级调用人力资源的 资源密级下拉选项
            List<SearchConditionOption> comOptions = hrmClassifiedProtectionBiz.getResourceOptionList(language);
            if (null != comOptions && comOptions.size() > 0) {
                for (SearchConditionOption searchConditionOptioninner : comOptions) {
                    String key = searchConditionOptioninner.getKey();
                    if (key.equals(fieldvalue)) {
                        seclevelLable = searchConditionOptioninner.getShowname();
                    }
                }

            }
        }
        //机密和秘密的时候会进行转换 机密：1  密级：2 ，可以做成动态判断但是暂时只有限定了这两种
        if (!StringHelper.isEmpty(secrettimeSpan) && !"0".equals(secrettimeSpan)) {// &&("1".equals(fieldvalue)||"2".equals(fieldvalue))
            seclevelLable+="★"+secrettimeSpan;//★
        }
        return seclevelLable;
    }

    public String getSeclevelForExcel(String fieldvalue, String paraTwo) {
        String name  ="";
        String secrettime = "";
        String secrettimeSpan ="";
        if (paraTwo.contains("+")) {
            String[] params = Util.TokenizerString2(paraTwo, "+");
            secrettimeSpan = (params[1] + "").trim();
        }

        AddSeclevelUtil  addSeclevelUtil  = new AddSeclevelUtil();
        // 判断 展示方式
        Map<String,Object> temp = addSeclevelUtil.getSecleveDefValueStyle(new HashMap<>() );
        if(!"0".equals(temp.get(fieldvalue)+"")){// 0 展示密级和密集保护时间  1  仅展示密级字段
            secrettimeSpan="";
        }


        //机密和秘密的时候会进行转换 机密：1  密级：2 ，可以做成动态判断但是暂时只有限定了这两种
        if (!StringHelper.isEmpty(secrettimeSpan)) {// &&("1".equals(fieldvalue)||"2".equals(fieldvalue))
            secrettime+="★"+secrettimeSpan;//★
        }

        return "{\"hreflink\":\""+name+"\",\"value\":\""+fieldvalue+"\",\"secrettime\":\""+secrettime+"\"  }";
    }
    public String getName(String name,String datashowtype){
        boolean real = false;
        if("1".equals(datashowtype)||"5".equals(datashowtype)){// 相册 纵向列表
           // real = true;
        }
        if(real){
            name = EncryptConfigBiz.getDecryptData(name);
        }
        return name;
    }
}